Skip to content

✍ Typo: [structural-kitchen] - two test names are exactly the same #285

Open
@alexhippo

Description

@alexhippo

Typo Report Checklist

  • I have pulled the latest main branch of the repository.
  • I have searched for related issues and pull requests and found none that matched my issue.
  • I have searched the word or phrase in question online to verify it's incorrect.
  • This is the appropriate issue form for the typo I would like to report.

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 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)."
	);
});

Additional Info

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    accepting prsYes please, send a pull request! ♥type: typoA mistake in text, such as a grammar or spelling error

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions