mirror of
https://github.com/AlecM33/Werewolf.git
synced 2025-12-26 15:57:50 +01:00
4-digit access codes
This commit is contained in:
@@ -260,4 +260,24 @@ describe('GameManager', () => {
|
||||
expect(gameManager.namespace.in().emit).toHaveBeenCalledWith(globals.EVENTS.NEW_SPECTATOR, jasmine.anything());
|
||||
});
|
||||
});
|
||||
|
||||
describe('#generateAccessCode', () => {
|
||||
it('should continue to generate access codes up to the max attempts when the generated code is already in use by another game', () => {
|
||||
gameManager.activeGameRunner.activeGames = {
|
||||
'AAAA': {}
|
||||
};
|
||||
|
||||
const accessCode = gameManager.generateAccessCode(['A']);
|
||||
expect(accessCode).toEqual(null); // we might the max generation attempts of 50.
|
||||
});
|
||||
|
||||
it('should generate and return a unique access code', () => {
|
||||
gameManager.activeGameRunner.activeGames = {
|
||||
'AAAA': {}
|
||||
};
|
||||
|
||||
const accessCode = gameManager.generateAccessCode(['B']);
|
||||
expect(accessCode).toEqual('BBBB');
|
||||
});
|
||||
})
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user