kopia lustrzana https://github.com/transitive-bullshit/chatgpt-api
pull/659/head
rodzic
8ced7643c8
commit
94a4c7763f
|
@ -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)
|
||||
})
|
||||
})
|
||||
|
|
|
@ -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('')
|
||||
})
|
||||
})
|
||||
|
|
Ładowanie…
Reference in New Issue