You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
15 lines
622 B
15 lines
622 B
|
2 days ago
|
import { index } from '@/api/calendars/index'
|
||
|
|
import request from '@/utils/request'
|
||
|
|
|
||
|
|
jest.mock('@/utils/request', () => jest.fn(config => config))
|
||
|
|
|
||
|
|
test('encodes title keywords without introducing extra query parameters', () => {
|
||
|
|
const config = index({ keyword: '科技&A+B#活动', is_publish: 0, page: 2 })
|
||
|
|
expect(request).toHaveBeenCalled()
|
||
|
|
const params = new URLSearchParams(config.paramsSerializer(config.params))
|
||
|
|
expect(params.get('keyword')).toBe('科技&A+B#活动')
|
||
|
|
expect(params.get('is_publish')).toBe('0')
|
||
|
|
expect(params.get('page')).toBe('2')
|
||
|
|
expect(Array.from(params.keys())).toHaveLength(3)
|
||
|
|
})
|