16 lines
505 B
TypeScript
16 lines
505 B
TypeScript
import { describe, expect, it } from 'vitest'
|
|
import { parseApiJsonResponse, parseJsonWithSafeIntegers } from '@chongchong/shared'
|
|
|
|
describe('safe integer API parsing', () => {
|
|
it('preserves backend long IDs as strings', () => {
|
|
expect(parseJsonWithSafeIntegers('{"id":2082674456475418625,"page":1}')).toEqual({
|
|
id: '2082674456475418625',
|
|
page: 1,
|
|
})
|
|
})
|
|
|
|
it('leaves non-JSON responses untouched', () => {
|
|
expect(parseApiJsonResponse('plain text')).toBe('plain text')
|
|
})
|
|
})
|