Skip to content
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

Test setups #33

Closed
richpjames opened this issue Jan 4, 2024 · 1 comment
Closed

Test setups #33

richpjames opened this issue Jan 4, 2024 · 1 comment

Comments

@richpjames
Copy link
Contributor

          Can we test that this transition doesn't occur there are still multiple players when a player leaves?

Perhaps this can go in a beforeEach for the entire MultiplePlayers block:

const actor = interpret(lobbyMachine);
actor.start();

actor.send({
  type: "playerJoins",
  player: { socketId: "id", name: "a name" },
});
actor.send({
  type: "playerJoins",
  player: { socketId: "id-2", name: "a name 2" },
});
expect(actor.getSnapshot().value).toBe("MultiplePlayers")
// another assertion that context.players.length === 2

This test could be transitions to the OnePlayer state if there are only two players and it receives a player leaves event, and the other test does not transition to the OnePlayer state if there are more than two players and it receives a player leaves event

Originally posted by @yndajas in #25 (comment)

@richpjames
Copy link
Contributor Author

This doesn't feel as relevant as it was when we created it so I'm going to close, but we can reopen if neccessary

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant