Skip to content

Commit 3bece2e

Browse files
committed
test: update attachLocation tests to verify migration to locations array
1 parent 22f4e8d commit 3bece2e

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

packages/sdk-core/tests/repository/HypercertOperationsImpl.test.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,18 @@ describe("HypercertOperationsImpl", () => {
547547
$type: "org.hypercerts.defs#uri",
548548
uri: "https://example.com/location",
549549
});
550+
551+
// Verify hypercert update used locations array
552+
const putCall = mockAgent.com.atproto.repo.putRecord.mock.calls[0][0];
553+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
554+
const updatedRecord = putCall.record as any;
555+
expect(updatedRecord.location).toBeUndefined();
556+
expect(updatedRecord.locations).toBeDefined();
557+
558+
expect(updatedRecord.locations).toHaveLength(1);
559+
expect(updatedRecord.locations[0].uri).toBe(result.uri);
550560
});
561+
551562
it("should attach a location using a GeoJSON Blob", async () => {
552563
const hypercertUri = "at://did:plc:test/org.hypercerts.claim.record/abc";
553564
const blob = new Blob([JSON.stringify({ type: "Point", coordinates: [0, 0] })], {
@@ -581,6 +592,16 @@ describe("HypercertOperationsImpl", () => {
581592
size: 100,
582593
},
583594
});
595+
596+
// Verify hypercert update used locations array
597+
const putCall = mockAgent.com.atproto.repo.putRecord.mock.calls[0][0];
598+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
599+
const updatedRecord = putCall.record as any;
600+
expect(updatedRecord.location).toBeUndefined();
601+
expect(updatedRecord.locations).toBeDefined();
602+
603+
expect(updatedRecord.locations).toHaveLength(1);
604+
expect(updatedRecord.locations[0].uri).toBe(result.uri);
584605
});
585606
});
586607

0 commit comments

Comments
 (0)