Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions packages/pi-plugin/src/embedding-bootstrap.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,13 @@ describe("ensureProjectRegisteredFromPiDirectory", () => {
embed: async () => new Float32Array([1, 0]),
embedBatch: async (texts: string[]) =>
texts.map(() => new Float32Array([1, 0])),
dispose: async () => {
// Non-async: the flag is recorded when dispose is *called*, which is the
// deterministic contract. disposeProvider is fire-and-forget
// (`void provider.dispose()`), so an async body here would make the
// assertion below depend on that body running before its first await.
dispose: () => {
disposed = true;
return Promise.resolve();
},
isLoaded: () => true,
}));
Expand Down Expand Up @@ -214,8 +219,13 @@ describe("ensureProjectRegisteredFromPiDirectory", () => {
embed: async () => new Float32Array([1, 0]),
embedBatch: async (texts: string[]) =>
texts.map(() => new Float32Array([1, 0])),
dispose: async () => {
// Non-async: the flag is recorded when dispose is *called*, which is the
// deterministic contract. disposeProvider is fire-and-forget
// (`void provider.dispose()`), so an async body here would make the
// assertion below depend on that body running before its first await.
dispose: () => {
disposed = true;
return Promise.resolve();
},
isLoaded: () => true,
}));
Expand Down
6 changes: 5 additions & 1 deletion packages/plugin/src/plugin/embedding-bootstrap.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,12 @@ function installShadowProvider(onDispose: () => void): void {
initialize: async () => true,
embed: async () => new Float32Array([1, 0]),
embedBatch: async (texts: string[]) => texts.map(() => new Float32Array([1, 0])),
dispose: async () => {
// Non-async: record the flag at call time. disposeProvider is
// fire-and-forget, so an async body would make the assertion depend on
// that body running before its first await rather than on retirement.
dispose: () => {
onDispose();
return Promise.resolve();
},
isLoaded: () => true,
}));
Expand Down
Loading