Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
4 tasks done
alexhippo opened this issue Nov 12, 2024 · 1 comment
Open
4 tasks done
Labels
accepting prs Yes please, send a pull request! ♥ type: typo A mistake in text, such as a grammar or spelling error

Comments

@alexhippo
Copy link

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

@alexhippo alexhippo added the type: typo A mistake in text, such as a grammar or spelling error label Nov 12, 2024
@JoshuaKGoldberg JoshuaKGoldberg added the accepting prs Yes please, send a pull request! ♥ label Nov 12, 2024
@JoshuaKGoldberg
Copy link
Contributor

Nice spot, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepting prs Yes please, send a pull request! ♥ type: typo A mistake in text, such as a grammar or spelling error
Projects
None yet
Development

No branches or pull requests

2 participants