Skip to content

Commit 27c36b3

Browse files
committed
test: add beforeEach to reset theme state
Add beforeEach hook to ensure theme is reset to 'socket' before each test runs, preventing test pollution from affecting "should default to socket theme" test. Fixes test failure where theme state leaked between tests.
1 parent 15583a4 commit 27c36b3

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

test/themes.test.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,14 @@ import {
1313
withTheme,
1414
withThemeSync,
1515
} from '@socketsecurity/lib/themes'
16-
import { afterEach, describe, expect, it } from 'vitest'
16+
import { afterEach, beforeEach, describe, expect, it } from 'vitest'
1717

1818
describe('themes', () => {
19-
// Reset theme to default after each test to ensure isolation
19+
// Reset theme to default before and after each test to ensure isolation
20+
beforeEach(() => {
21+
setTheme('socket')
22+
})
23+
2024
afterEach(() => {
2125
setTheme('socket')
2226
})

0 commit comments

Comments
 (0)