Skip to content

Instantly share code, notes, and snippets.

@trikitrok
Last active June 30, 2024 14:32
Show Gist options
  • Save trikitrok/a1aec1d8cc29df988e04 to your computer and use it in GitHub Desktop.
Save trikitrok/a1aec1d8cc29df988e04 to your computer and use it in GitHub Desktop.
Conway's rules tests initial names
describe("rules", function() {
describe("rule to go on living", function() {
it("dies with more than 3 neighbors", function() {
expect(rules.goesOnLivingWith(4)).toBe(false);
});
it("dies with less than 2 neighbors", function() {
expect(rules.goesOnLivingWith(1)).toBe(false);
});
it("goes on living with 2 or 3 neighbors", function() {
expect(rules.goesOnLivingWith(3)).toBe(true);
expect(rules.goesOnLivingWith(2)).toBe(true);
});
});
describe("rule to be created", function() {
it("is created with 3 neighbors", function () {
expect(rules.isCreatedWith(3)).toBe(true);
});
it("is not created with less than 3 neighbors", function () {
expect(rules.isCreatedWith(1)).toBe(false);
});
it("is not created with more than 3 neighbors", function () {
expect(rules.isCreatedWith(4)).toBe(false);
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment