|
1 | 1 |
|
2 | | -import { describe, expect, test, beforeEach, afterEach, mock } from 'bun:test'; |
| 2 | +import { afterEach, describe, expect, mock, test } from 'bun:test'; |
3 | 3 |
|
4 | 4 | const runtimeFetchMock = mock(() => Promise.resolve({ status: 200 })); |
5 | 5 | mock.module('../src/utils/runtime', () => ({ |
@@ -62,17 +62,24 @@ describe('testUrls edge cases', () => { |
62 | 62 | return Promise.reject(new Error('fail')); |
63 | 63 | }); |
64 | 64 |
|
65 | | - const result = await testUrls(['http://fail.local', 'http://success.local']); |
| 65 | + const result = await testUrls([ |
| 66 | + 'http://fail.local', |
| 67 | + 'http://success.local', |
| 68 | + ]); |
66 | 69 | expect(result).toBe('http://success.local'); |
67 | 70 | }); |
68 | 71 |
|
69 | 72 | test('Fastest Response: returns the URL that resolves first', async () => { |
70 | 73 | runtimeFetchMock.mockImplementation((url: string) => { |
71 | 74 | if (url === 'http://fast.local') { |
72 | | - return new Promise((resolve) => setTimeout(() => resolve({ status: 200 }), 10)); |
| 75 | + return new Promise((resolve) => |
| 76 | + setTimeout(() => resolve({ status: 200 }), 10), |
| 77 | + ); |
73 | 78 | } |
74 | 79 | if (url === 'http://slow.local') { |
75 | | - return new Promise((resolve) => setTimeout(() => resolve({ status: 200 }), 50)); |
| 80 | + return new Promise((resolve) => |
| 81 | + setTimeout(() => resolve({ status: 200 }), 50), |
| 82 | + ); |
76 | 83 | } |
77 | 84 | return Promise.reject(new Error('fail')); |
78 | 85 | }); |
|
0 commit comments