Skip to content

Commit

Permalink
test: fix repository tests
Browse files Browse the repository at this point in the history
  • Loading branch information
shumkov committed Mar 17, 2022
1 parent ac0577d commit 413bdae
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ describe('DataContractStoreRepository', () => {
});

it('should fetch Data Contract', async () => {
await store.getDrive().applyContract(dataContract, false);
await store.getDrive().applyContract(dataContract, new Date(), false);

const storedDataContract = await repository.fetch(dataContract.getId());

Expand All @@ -119,7 +119,7 @@ describe('DataContractStoreRepository', () => {
it('should fetch Data Contract using transaction', async () => {
await store.startTransaction();

await store.getDrive().applyContract(dataContract, true);
await store.getDrive().applyContract(dataContract, new Date(), true);

const notFoundDataContract = await repository.fetch(dataContract.getId(), false);

Expand Down
18 changes: 10 additions & 8 deletions packages/js-drive/test/unit/document/DocumentRepository.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,11 @@ describe('DocumentRepository', () => {
{ useTransaction: false },
);

expect(driveMock.createDocument).to.be.calledOnceWithExactly(
document,
false,
);
expect(driveMock.createDocument.getCall(0).args).to.have.lengthOf(3);

expect(driveMock.createDocument.getCall(0).args[0]).to.equals(document);
expect(driveMock.createDocument.getCall(0).args[1]).to.be.instanceOf(Date);
expect(driveMock.createDocument.getCall(0).args[2]).to.equals(false);

expect(loggerMock.info).to.be.calledOnce();
});
Expand All @@ -100,10 +101,11 @@ describe('DocumentRepository', () => {
{ useTransaction: true },
);

expect(driveMock.updateDocument).to.be.calledOnceWithExactly(
document,
true,
);
expect(driveMock.updateDocument.getCall(0).args).to.have.lengthOf(3);

expect(driveMock.updateDocument.getCall(0).args[0]).to.equals(document);
expect(driveMock.updateDocument.getCall(0).args[1]).to.be.instanceOf(Date);
expect(driveMock.updateDocument.getCall(0).args[2]).to.equals(true);
});
});

Expand Down

0 comments on commit 413bdae

Please sign in to comment.