优化构架
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
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')
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user