Skip to content

Commit 0d8c6fb

Browse files
chore(deps): update dependency sanitize-filename to v1.6.4 (#810)
* chore(deps): update dependency sanitize-filename to v1.6.4 * test: fix flaky change detection test by wrapping rerender with act --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Elliott de Launay <edelaunay@wealthsimple.com>
1 parent f07ae73 commit 0d8c6fb

2 files changed

Lines changed: 37 additions & 31 deletions

File tree

pnpm-lock.yaml

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

webview-ui/src/components/settings/__tests__/SettingsView.change-detection.spec.tsx

Lines changed: 33 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -436,22 +436,25 @@ describe("SettingsView - Change Detection Fix", () => {
436436
fireEvent.click(screen.getByTestId("set-provider-deepseek"))
437437
expect(screen.getByTestId("provider-value")).toHaveTextContent("deepseek")
438438

439-
extensionState = createExtensionState({
440-
settingsImportedAt: 123,
441-
soundEnabled: true,
442-
apiConfiguration: {
443-
apiProvider: "baseten",
444-
apiModelId: "zai-org/GLM-4.6",
445-
basetenApiKey: "test-baseten-key",
446-
},
439+
await act(async () => {
440+
extensionState = createExtensionState({
441+
settingsImportedAt: 123,
442+
soundEnabled: true,
443+
apiConfiguration: {
444+
apiProvider: "baseten",
445+
apiModelId: "zai-org/GLM-4.6",
446+
basetenApiKey: "test-baseten-key",
447+
},
448+
})
449+
;(useExtensionState as any).mockImplementation(() => extensionState)
450+
451+
rerender(
452+
<QueryClientProvider client={queryClient}>
453+
<SettingsView onDone={onDone} />
454+
</QueryClientProvider>,
455+
)
447456
})
448457

449-
rerender(
450-
<QueryClientProvider client={queryClient}>
451-
<SettingsView onDone={onDone} />
452-
</QueryClientProvider>,
453-
)
454-
455458
// Let the import cache-busting effect run. With the old implementation,
456459
// this would reset cachedState back to the replayed Baseten config.
457460
await act(async () => {
@@ -497,21 +500,24 @@ describe("SettingsView - Change Detection Fix", () => {
497500
fireEvent.click(screen.getByTestId("set-provider-deepseek"))
498501
expect(screen.getByTestId("provider-value")).toHaveTextContent("deepseek")
499502

500-
extensionState = createExtensionState({
501-
settingsImportedAt: 101,
502-
apiConfiguration: {
503-
apiProvider: "baseten",
504-
apiModelId: "zai-org/GLM-4.6",
505-
basetenApiKey: "imported-baseten-key",
506-
},
503+
await act(async () => {
504+
extensionState = createExtensionState({
505+
settingsImportedAt: 101,
506+
apiConfiguration: {
507+
apiProvider: "baseten",
508+
apiModelId: "zai-org/GLM-4.6",
509+
basetenApiKey: "imported-baseten-key",
510+
},
511+
})
512+
;(useExtensionState as any).mockImplementation(() => extensionState)
513+
514+
rerender(
515+
<QueryClientProvider client={queryClient}>
516+
<SettingsView onDone={onDone} />
517+
</QueryClientProvider>,
518+
)
507519
})
508520

509-
rerender(
510-
<QueryClientProvider client={queryClient}>
511-
<SettingsView onDone={onDone} />
512-
</QueryClientProvider>,
513-
)
514-
515521
await waitFor(() => {
516522
expect(screen.getByTestId("provider-value")).toHaveTextContent("baseten")
517523
})

0 commit comments

Comments
 (0)