Skip to content

Commit 0a704d7

Browse files
committed
chore: polish
1 parent e3bfece commit 0a704d7

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

src/core/utils/request/onUnhandledRequest.node.test.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,16 @@ If you still wish to intercept this unhandled request, please create a request h
2828
Read more: https://mswjs.io/docs/http/intercepting-requests`,
2929
}
3030

31-
beforeEach(() => {
31+
beforeAll(() => {
3232
vi.spyOn(console, 'warn').mockImplementation(() => void 0)
3333
vi.spyOn(console, 'error').mockImplementation(() => void 0)
3434
})
3535

3636
afterEach(() => {
37+
vi.clearAllMocks()
38+
})
39+
40+
afterAll(() => {
3741
vi.restoreAllMocks()
3842
})
3943

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
/**
2-
* @vitest-environment node
3-
*/
1+
// @vitest-environment node
42
import { toPublicUrl } from './toPublicUrl'
53

64
test('returns an absolute request URL without search params', () => {
@@ -12,8 +10,8 @@ test('returns an absolute request URL without search params', () => {
1210
'http://192.168.0.10/path',
1311
)
1412

15-
// URLs returned in a Node.js environment are never relative.
16-
expect(toPublicUrl(new URL('http://localhost/path?foo=bar'))).toBe(
17-
'http://localhost/path',
18-
)
13+
expect(
14+
toPublicUrl(new URL('http://localhost/path?foo=bar')),
15+
'Must not return relative URL in Node.js',
16+
).toBe('http://localhost/path')
1917
})

src/core/utils/request/toPublicUrl.test.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
/**
2-
* @vitest-environment jsdom
3-
*/
1+
// @vitest-environment jsdom
42
import { toPublicUrl } from './toPublicUrl'
53

64
test('returns an absolute request URL without search params', () => {

0 commit comments

Comments
 (0)