Closed AChao628 closed 2 years ago
import { EXPRESSION_TYPE } from '@common' // import checkObjectAccessRight from '@mstr/react-object-browser/es/service/browserUtils' // import ACCESS_RIGHTS from '@mstr/react-object-browser/es/service/browserConstants' import { getCustomizedSearchService, getElementDefaultDefinition, isItemAllowToDrop, } from '../utils'
// jest.mock('@mstr/react-qualification-panel/es/components/QualificationPanel/FilterHelper', () => ({ // FilterNormalizer: { getId: () => 'id1' }, // })) // jest.mock( // '@mstr/react-qualification-panel/es/components/QualificationPanel/FilterHelper/config', // () => ({ // predicateTypes: { // ELEMENT_LIST_QUALIFICATION: 'predicate_element_list', // }, // }) // )
jest.mock('@mstr/react-object-browser/es/service/browserUtils', () => ({ checkObjectAccessRight: () => true, ACCESS_RIGHTS: { USE: 64, READ: 4, }, })) // // jest.mock('@mstr/react-object-browser/es/service/browserConstants', () => ({ // }))
describe('util.ts', () => { describe('getElementDefaultDefinition', () => { const attributeInfo = { id: '4151F1304F00A51EB13BCF84283396BE', name: 'Customer Gender', type: 12, subtype: 3072, } const selectedElements = [] const promptInfo = { objectId: '0EF9AED86E844C9CBBDF05B549332BE8', subType: '', name: '', } beforeEach(() => { // attributeInfo }) it('', () => { // const res = getElementDefaultDefinition(attributeInfo, selectedElements, promptInfo) // expect(res.information).to.equals(promptInfo) }) }) describe('isItemAllowToDrop', () => { it('item is undefined', () => { expect(isItemAllowToDrop(undefined)).toEqual(false) }) it('should ', () => { const res = isItemAllowToDrop({}, [], [], 'id', {}, [], EXPRESSION_TYPE.Hierarchy)
expect(res).toEqual(false)
})
}) describe('getCustomizedSearchService', () => { it('return attributes in a hierarchy', async () => { const service = getCustomizedSearchService( EXPRESSION_TYPE.Hierarchy, { hierarchyId1: [{ id: 'attribute1' }, { id: 'attribute2' }], }, 'hierarchyId1', [], {}, [] ) const res = await service(undefined, undefined, undefined, undefined) expect(res.data.result[0].id).toEqual('attribute2') }) it('should return predefinedObjects', async () => { const service = getCustomizedSearchService( EXPRESSION_TYPE.Attribute, { hierarchyId1: [{ id: 'attribute1' }, { id: 'attribute2' }], }, 'hierarchyId1', [{ id: 'predefinedObjectId1' }], {}, [] ) const res = await service(undefined, undefined, undefined, undefined) expect(res.data.result[0].id).toEqual('predefinedObjectId1') }) it('should return search results', async () => { const service = getCustomizedSearchService( EXPRESSION_TYPE.Attribute, { hierarchyId1: [{ id: 'attribute1' }, { id: 'attribute2' }], }, 'hierarchyId1', [], {}, [{ id: 'searchObjectResultId1' }] ) const res = await service(undefined, undefined, undefined, undefined) expect(res.data.result[0].id).toEqual('searchObjectResultId1') }) }) })
jest.mock('@mstr/react-object-browser/es/service/browserUtils', () => ({ checkObjectAccessRight: () => true, }))
jest.mock('@mstr/react-object-browser/es/service/browserConstants', () => ({ ACCESS_RIGHTS: { USE: 64, READ: 4, }, }))
I got a passing score on the KCNA Exam and my Certificate ID Number is LF-cvhd54fq6b.
Quick, active, and high-quality reviews on other colleagues' pull requests with the #effective review comments per PR of 2.76(559/202).