add reversibility on category level

This commit is contained in:
undergroundwires
2020-09-01 21:18:16 +01:00
parent d235dee955
commit f51e8859ee
23 changed files with 717 additions and 162 deletions

View File

@@ -95,4 +95,26 @@ describe('InMemoryRepository', () => {
expect(actual).to.deep.equal(expected);
});
});
describe('getById', () => {
it('gets entity if it exists', () => {
// arrange
const expected = new NumericEntityStub(1).withCustomProperty('bca');
const sut = new InMemoryRepository<number, NumericEntityStub>([
expected, new NumericEntityStub(2).withCustomProperty('bca'),
new NumericEntityStub(3).withCustomProperty('bca'), new NumericEntityStub(4).withCustomProperty('bca'),
]);
// act
const actual = sut.getById(expected.id);
// assert
expect(actual).to.deep.equal(expected);
});
it('gets undefined if it does not exist', () => {
// arrange
const sut = new InMemoryRepository<number, NumericEntityStub>([]);
// act
const actual = sut.getById(31);
// assert
expect(actual).to.equal(undefined);
});
});
});