Skip to content

Instantly share code, notes, and snippets.

@Balastrong
Created August 17, 2022 08:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Balastrong/336a7aed5a951c30ad8832b001215769 to your computer and use it in GitHub Desktop.
Save Balastrong/336a7aed5a951c30ad8832b001215769 to your computer and use it in GitHub Desktop.
wrand - tests 2
it("should throw an error if created with a wrong set of items", () => {
// Duplicate item
expect(
() => new RandomPicker([...items, { original: "Platinum", weight: 5 }])
).toThrow();
// Empty list
expect(() => new RandomPicker([])).toThrow();
// Negative weight
expect(
() => new RandomPicker([{ original: "Wood", weight: -5 }])
).toThrow();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment