diff --git a/src/url-utils.test.ts b/src/url-utils.test.ts index 3523821de..ff5e278c4 100644 --- a/src/url-utils.test.ts +++ b/src/url-utils.test.ts @@ -20,12 +20,12 @@ describe('normalizeUrl', () => { }) test('invalid urls', async () => { - expect(normalizeUrl('/foo')).toBe(null) - expect(normalizeUrl('/foo/bar/baz')).toBe(null) - expect(normalizeUrl('://foo.com')).toBe(null) - expect(normalizeUrl('foo')).toBe(null) - expect(normalizeUrl('')).toBe(null) - expect(normalizeUrl(undefined as unknown as string)).toBe(null) - expect(normalizeUrl(null as unknown as string)).toBe(null) + expect(normalizeUrl('/foo')).toBe(undefined) + expect(normalizeUrl('/foo/bar/baz')).toBe(undefined) + expect(normalizeUrl('://foo.com')).toBe(undefined) + expect(normalizeUrl('foo')).toBe(undefined) + expect(normalizeUrl('')).toBe(undefined) + expect(normalizeUrl(undefined as unknown as string)).toBe(undefined) + expect(normalizeUrl(null as unknown as string)).toBe(undefined) }) }) diff --git a/src/utils.test.ts b/src/utils.test.ts index b234243ff..774bbbcac 100644 --- a/src/utils.test.ts +++ b/src/utils.test.ts @@ -52,6 +52,25 @@ test('sanitizeSearchParams', () => { expect(sanitizeSearchParams({ a: [] }).toString()).toMatchSnapshot() }) +describe('stringifyForModel', () => { + test('handles basic objects', () => { + const input = { + foo: 'bar', + nala: ['is', 'cute'], + kittens: null, + cats: undefined, + paws: 4.3 + } + const result = stringifyForModel(input) + expect(result).toEqual(JSON.stringify(input, null)) + }) + + test('handles empty input', () => { + const result = stringifyForModel() + expect(result).toEqual('') + }) +}) + test( 'throttleKy should rate-limit requests to ky properly', async () => { @@ -85,22 +104,3 @@ test( timeout: 60_000 } ) - -describe('stringifyForModel', () => { - test('handles basic objects', () => { - const input = { - foo: 'bar', - nala: ['is', 'cute'], - kittens: null, - cats: undefined, - paws: 4.3 - } - const result = stringifyForModel(input) - expect(result).toEqual(JSON.stringify(input, null)) - }) - - test('handles empty input', () => { - const result = stringifyForModel() - expect(result).toEqual('') - }) -})