Skip to content
Snippets Groups Projects
Commit 3077bd4a authored by Yoan VALLET's avatar Yoan VALLET
Browse files

feat: complete konnectors tests

parent c7189871
No related branches found
No related tags found
1 merge request!139Features/unit tests
...@@ -21,8 +21,8 @@ jest.mock('./triggers.service', () => { ...@@ -21,8 +21,8 @@ jest.mock('./triggers.service', () => {
describe('KonnectorService service', () => { describe('KonnectorService service', () => {
const konnectorService = new KonnectorService(mockClient) const konnectorService = new KonnectorService(mockClient)
describe('getFluidConfig method', () => { describe('getKonnector method', () => {
it('shoud return an array with the fluid config', async () => { it('shoud return konnector', async () => {
const mockQueryResult: QueryResult<Konnector[]> = { const mockQueryResult: QueryResult<Konnector[]> = {
data: [konnectorsData[0]], data: [konnectorsData[0]],
bookmark: '', bookmark: '',
...@@ -33,6 +33,18 @@ describe('KonnectorService service', () => { ...@@ -33,6 +33,18 @@ describe('KonnectorService service', () => {
const result = await konnectorService.getKonnector('enedisgrandlyon') const result = await konnectorService.getKonnector('enedisgrandlyon')
expect(result).toEqual(konnectorsData[0]) expect(result).toEqual(konnectorsData[0])
}) })
it('shoud return null when konnector is not found', async () => {
const mockQueryResult: QueryResult<Konnector[]> = {
data: [],
bookmark: '',
next: false,
skip: 0,
}
mockClient.query.mockResolvedValueOnce(mockQueryResult)
const result = await konnectorService.getKonnector('enedisgrandlyon')
expect(result).toBeNull()
})
}) })
describe('getKonnectorLastState method', () => { describe('getKonnectorLastState method', () => {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment