Skip to content

Commit

Permalink
fix(emmet-esdb, emmet): fix in memory test case to expect correct value
Browse files Browse the repository at this point in the history
  • Loading branch information
thiagomini committed Mar 6, 2024
1 parent 10b48e7 commit b14efe9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ describe('EventStoreDBEventStore', () => {
});

describe('aggregateStream', () => {
it('When called with `to` allows time travelling', async () => {
it('When called with `to` allows time traveling', async () => {
// Given
const productItem: PricedProductItem = {
productId: '123',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const evolve = (
case 'DiscountApplied':
return {
...state,
totalAmount: state.totalAmount * (1 - data.percent),
totalAmount: state.totalAmount * (1 - data.percent / 100),
};
}
};
Expand Down Expand Up @@ -96,20 +96,19 @@ describe('InMemoryEventStore', () => {
assert.equal(resultAt1.currentStreamVersion, 1);
assert.deepEqual(resultAt1.state, {
productItems: [productItem],
totalAmount: productItem.price * productItem.quantity,
totalAmount: 30,
});

assert.equal(resultAt2.currentStreamVersion, 2);
assert.deepEqual(resultAt2.state, {
productItems: [productItem, productItem],
totalAmount: productItem.price * productItem.quantity * 2,
totalAmount: 60,
});

assert.equal(resultAt3.currentStreamVersion, 3);
assert.deepEqual(resultAt3.state, {
productItems: [productItem, productItem],
totalAmount:
productItem.price * productItem.quantity * 2 * (1 - discount),
totalAmount: 54,
});
});
});
Expand Down

0 comments on commit b14efe9

Please sign in to comment.