Two of the tests for the purchase function appear to have the same it clause:
returns false without changing stock when expense is less than budget on a second call
According to the test content, I think the 2nd test name should be it returns true without changing stock when expense is less than budget on a second call. Unless I am understanding this scenario incorrectly?
Thanks, your book has been very helpful so far.
it("returns false without changing stock when expense is less than budget on a second call", () => {
const supplier = jest.fn((expense: number) => ({
breads: expense * 1,
fruits: expense * 2,
sauces: expense * 3,
vegetables: expense * 4,
}));
const kitchen = createKitchen(5, jest.fn<index.Cleaner>(), supplier);
kitchen.purchase(3);
const result = kitchen.purchase(3);
expect(result).toBe(false);
expect(kitchen.announce()).toBe(
"I have 0 much dirt, 2 budget, 3 bread(s), 6 fruit(s), 9 sauce(s), and 12 vegetable(s)."
);
});
it("returns false without changing stock when expense is less than budget on a second call", () => {
const supplier = jest.fn((expense: number) => ({
breads: expense * 1,
fruits: expense * 2,
sauces: expense * 3,
vegetables: expense * 4,
}));
const kitchen = createKitchen(5, jest.fn<index.Cleaner>(), supplier);
kitchen.purchase(3);
const result = kitchen.purchase(2);
expect(result).toBe(true);
expect(kitchen.announce()).toBe(
"I have 0 much dirt, 0 budget, 5 bread(s), 10 fruit(s), 15 sauce(s), and 20 vegetable(s)."
);
});
Typo Report Checklist
main
branch of the repository.Impacted Project File
learning-typescript-projects/projects/functions/structural-kitchen/src/index.test.ts
What's Wrong?
Two of the tests for the
purchase
function appear to have the sameit
clause:According to the test content, I think the 2nd test name should be
it returns true without changing stock when expense is less than budget on a second call
. Unless I am understanding this scenario incorrectly?Thanks, your book has been very helpful so far.
Additional Info
No response