| 123456789101112131415161718192021222324252627282930313233343536 |
- import UrlOptionsBuilder from '~/services/connection/urlOptionsBuilder'
- import {QUERY_TYPE} from '~/types/enums'
- import {DataProviderArgs} from "~/types/interfaces";
- describe('build()', () => {
- it('should return an array with options URL image at the end', () => {
- const args: DataProviderArgs = {
- type: QUERY_TYPE.IMAGE,
- imgArgs: {
- id:1,
- height:100,
- width:100
- }
- }
- jest.useFakeTimers('modern');
- jest.setSystemTime(new Date(2020, 3, 1));
- const options = UrlOptionsBuilder.build(args)
- expect(options.pop()).toEqual('1585692000000')
- })
- it('should return an array with options lists', () => {
- const args: DataProviderArgs = {
- type: QUERY_TYPE.MODEL,
- listArgs: {
- itemsPerPage:10,
- page:1
- }
- }
- const options = UrlOptionsBuilder.build(args)
- expect(options.pop()).toEqual('page=1')
- expect(options.pop()).toEqual('itemsPerPage=10')
- })
- })
|