|
| 1 | +import {IPortalQueryParam} from '../../../src/common/iPortal/IPortalQueryParam'; |
| 2 | + |
| 3 | +describe('IPortalQueryParam', () => { |
| 4 | + it('resourceType', () => { |
| 5 | + var param = new IPortalQueryParam({resourceType: 'MAP'}); |
| 6 | + expect(param).not.toBeNull(); |
| 7 | + expect(param.resourceType).toEqual('MAP'); |
| 8 | + }); |
| 9 | + |
| 10 | + it('pageSize', () => { |
| 11 | + var param = new IPortalQueryParam({ pageSize: 9 }); |
| 12 | + expect(param).not.toBeNull(); |
| 13 | + expect(param.pageSize).toEqual(9); |
| 14 | + }); |
| 15 | + |
| 16 | + it('currentPage', () => { |
| 17 | + var param = new IPortalQueryParam({ currentPage: 2 }); |
| 18 | + expect(param).not.toBeNull(); |
| 19 | + expect(param.currentPage).toEqual(2); |
| 20 | + }); |
| 21 | + |
| 22 | + it('orderBy', () => { |
| 23 | + var param = new IPortalQueryParam({ orderBy: 'HEATLEVEL' }); |
| 24 | + expect(param).not.toBeNull(); |
| 25 | + expect(param.orderBy).toEqual('HEATLEVEL'); |
| 26 | + }); |
| 27 | + |
| 28 | + it('orderType', () => { |
| 29 | + var param = new IPortalQueryParam({ orderType: 'ASC' }); |
| 30 | + expect(param).not.toBeNull(); |
| 31 | + expect(param.orderType).toEqual('ASC'); |
| 32 | + }); |
| 33 | + |
| 34 | + it('searchType', () => { |
| 35 | + var param = new IPortalQueryParam({ searchType: 'SHARETOME_RES' }); |
| 36 | + expect(param).not.toBeNull(); |
| 37 | + expect(param.searchType).toEqual('SHARETOME_RES'); |
| 38 | + }); |
| 39 | + |
| 40 | + it('tags', () => { |
| 41 | + var param = new IPortalQueryParam({ tags: ['test'] }); |
| 42 | + expect(param).not.toBeNull(); |
| 43 | + expect(param.tags[0]).toEqual('test'); |
| 44 | + }); |
| 45 | + |
| 46 | + it('dirIds', () => { |
| 47 | + var param = new IPortalQueryParam({ dirIds: [1,2] }); |
| 48 | + expect(param).not.toBeNull(); |
| 49 | + expect(param.dirIds[1]).toEqual(2); |
| 50 | + }); |
| 51 | + |
| 52 | + it('resourceSubTypes', () => { |
| 53 | + var param = new IPortalQueryParam({ resourceSubTypes: ['type'] }); |
| 54 | + expect(param).not.toBeNull(); |
| 55 | + expect(param.resourceSubTypes[0]).toEqual('type'); |
| 56 | + }); |
| 57 | + |
| 58 | + it('aggregationTypes', () => { |
| 59 | + var param = new IPortalQueryParam({ aggregationTypes: ["SUBTYPE","TAG"] }); |
| 60 | + expect(param).not.toBeNull(); |
| 61 | + expect(param.aggregationTypes[1]).toEqual('TAG'); |
| 62 | + }); |
| 63 | + |
| 64 | + it('text', () => { |
| 65 | + var param = new IPortalQueryParam({ text: 'test' }); |
| 66 | + expect(param).not.toBeNull(); |
| 67 | + expect(param.text).toEqual('test'); |
| 68 | + }); |
| 69 | + |
| 70 | + it('groupIds', () => { |
| 71 | + var param = new IPortalQueryParam({ groupIds: [1,3] }); |
| 72 | + expect(param).not.toBeNull(); |
| 73 | + expect(param.groupIds[1]).toEqual(3); |
| 74 | + }); |
| 75 | + |
| 76 | + it('departmentIds', () => { |
| 77 | + var param = new IPortalQueryParam({ departmentIds: [3] }); |
| 78 | + expect(param).not.toBeNull(); |
| 79 | + expect(param.departmentIds[0]).toEqual(3); |
| 80 | + }); |
| 81 | +}); |
0 commit comments