Skip to content

Commit fd335d2

Browse files
committed
Improve test isolation
- Add afterEach to restore all mocks - Remove unnecessary mockClear() calls - Ensures tests are properly isolated
1 parent da27836 commit fd335d2

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/server/auth/handlers/authorize.test.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,10 @@ describe('Authorization Handler', () => {
102102
app.use('/authorize', handler);
103103
});
104104

105+
afterEach(() => {
106+
jest.restoreAllMocks();
107+
});
108+
105109
describe('HTTP method validation', () => {
106110
it('rejects non-GET/POST methods', async () => {
107111
const response = await supertest(app)
@@ -305,7 +309,6 @@ describe('Authorization Handler', () => {
305309

306310
it('propagates nonce parameter for OpenID Connect flows', async () => {
307311
const mockProviderWithNonce = jest.spyOn(mockProvider, 'authorize');
308-
mockProviderWithNonce.mockClear();
309312

310313
const response = await supertest(app)
311314
.get('/authorize')
@@ -334,7 +337,6 @@ describe('Authorization Handler', () => {
334337

335338
it('handles authorization without nonce parameter', async () => {
336339
const mockProviderWithoutNonce = jest.spyOn(mockProvider, 'authorize');
337-
mockProviderWithoutNonce.mockClear();
338340

339341
const response = await supertest(app)
340342
.get('/authorize')

0 commit comments

Comments
 (0)