Skip to content

Commit

Permalink
[test] Add getCountWithStatusCase test
Browse files Browse the repository at this point in the history
  • Loading branch information
konovalovsergey committed Sep 3, 2024
1 parent 5a68653 commit 681b57c
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion tests/integration/databaseTests/baseConnector.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@ const getExpiredCase = [
'baseConnector-getExpired()-tester-1',
'baseConnector-getExpired()-tester-2',
];
const getCountWithStatusCase = [
'baseConnector-getCountWithStatusCase()-tester-0'
];
const upsertCases = {
insert: 'baseConnector-upsert()-tester-row-inserted',
update: 'baseConnector-upsert()-tester-row-updated'
Expand Down Expand Up @@ -205,7 +208,7 @@ afterAll(async function () {
const upsertIds = Object.values(upsertCases);

const tableChangesIds = [...emptyCallbacksCase, ...documentsWithChangesCase, ...changesIds, ...insertIds];
const tableResultIds = [...emptyCallbacksCase, ...documentsWithChangesCase, ...getExpiredCase, ...upsertIds];
const tableResultIds = [...emptyCallbacksCase, ...documentsWithChangesCase, ...getExpiredCase, ...getCountWithStatusCase, ...upsertIds];

const deletionPool = [
deleteRowsByIds(cfgTableChanges, tableChangesIds),
Expand Down Expand Up @@ -413,6 +416,17 @@ describe('Base database connector', function () {

expect(resultAfterNewRows.length).toEqual(resultBeforeNewRows.length + getExpiredCase.length);
});

test('Get Count With Status', async function () {
let countWithStatus = await baseConnector.getCountWithStatus(ctx, commonDefines.FileStatus.SaveVersion);
expect(countWithStatus).toEqual(0);
for (const id of getCountWithStatusCase) {
const task = createTask(id);
task.status = commonDefines.FileStatus.SaveVersion;
await insertIntoResultTable(date, task);
}
expect(countWithStatus).toEqual(getCountWithStatusCase.length);
});
});

describe('upsert() method', function () {
Expand Down

0 comments on commit 681b57c

Please sign in to comment.