Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): linked environments pick up the other machine's new name #29779

Mergedsaphid(GitHub profile, opens in a new tab)merged 2 commits intomain fromrefs/pull/29779/headmerged by maria-rcks View on GitHub

Showing 2 changed files with 60 additions and 21 deletions.

x
0 of 2 viewed, 2 left
21 additions and 0 deletionsapps/server/src/peer/PeerLinks.test.tsModified
View file
@@ -410,6 +410,27 @@
).pipe(Effect.provide(NodeHttpServer.layerTest)),
​
+it.effect("a linked peer that is renamed shows its new name", () =>
+ Effect.scoped(
+ Effect.gen(function* () {
+ const b = yield* serveB(box);
+ const a = yield* makeA(laptop);
+ const pairing = yield* b.auth.issuePairingCredential();
+ yield* a.links.link({ url: b.url, pairingCode: pairing.credential, access: "auto" });
+​
+ yield* Ref.set(b.descriptor, descriptorOf(box.environmentId, "Box Mini"));
+ expect((yield* a.links.resolve(box.environmentId)).link.label).toBe("Box Mini");
+ const stored = yield* a.links.get(box.environmentId);
+ expect(Option.map(stored, (link) => link.label)).toEqual(Option.some("Box Mini"));
+​
+ yield* Ref.set(b.descriptor, descriptorOf(box.environmentId, "Box Studio"));
+ expect((yield* a.links.list).map((link) => link.label)).toEqual(["Box Studio"]);
+ const storedAfterList = yield* a.links.get(box.environmentId);
+ expect(Option.map(storedAfterList, (link) => link.label)).toEqual(Option.some("Box Studio"));
+ }),
+ ).pipe(Effect.provide(NodeHttpServer.layerTest)),
+);
+​
it.effect("tells the agent to link again once the peer revokes the link or it expires", () =>
Effect.scoped(
Effect.gen(function* () {