diff --git a/bob_party/src/core/tests/gameCasino.test.ts b/bob_party/src/core/tests/gameCasino.test.ts index cd68e75..6900cd3 100644 --- a/bob_party/src/core/tests/gameCasino.test.ts +++ b/bob_party/src/core/tests/gameCasino.test.ts @@ -1,3 +1,53 @@ import { GameCasino } from '../GameCasino'; + +// Instances +let game = new GameCasino("bo jeu", require('bob_party/assets/ImagesJeux/blackjack.jpg'), "super jeu", 1, 5); + + +// Get tests +describe('GameMuti get tests', () => { + it('should return bo jeu', () => { + expect(game.getName()).toBe('bo jeu'); + }) + it('should return require(blackjack.jpg)', () => { + expect(game.getImageSource()).toBe(require('bob_party/assets/ImagesJeux/blackjack.jpg')); + }) + it('should return super jeu', () => { + expect(game.getGameSource()).toBe('super jeu'); + }) + it('should return 1', () => { + expect(game.getNbPlayerMin()).toBe(1); + }) + it('should return 5', () => { + expect(game.getNbPlayerMax()).toBe(5); + }) +}) + + +// Setting new values +game.setGameSource('trop cool le jeu'); +game.setImageSource(require('bob_party/assets/ImagesJeux/JeuDeDame.jpg')); +game.setName('beau jeu'); +game.setNbPlayerMin(2); +game.setNbPlayerMax(4); + + +// Set tests +describe('GameCasino set tests', () => { + it('should return beau jeu', () => { + expect(game.getName()).toBe('beau jeu'); + }) + it('should return require(JeuDeDame.jpg)', () => { + expect(game.getImageSource).toBe(require('bob_party/assets/ImagesJeux/JeuDeDame.jpg')); + }) + it('should return trop cool le jeu', () => { + expect(game.getGameSource()).toBe('trop cool le jeu'); + }) + it('should return trop cool le jeu', () => { + expect(game.getNbPlayerMin()).toBe(2); + }) + it('should return 4', () => { + expect(game.getNbPlayerMin()).toBe(4); + }) \ No newline at end of file diff --git a/bob_party/src/core/tests/gameMulti.test.ts b/bob_party/src/core/tests/gameMulti.test.ts index bcde5ec..61e0e3c 100644 --- a/bob_party/src/core/tests/gameMulti.test.ts +++ b/bob_party/src/core/tests/gameMulti.test.ts @@ -8,7 +8,7 @@ let myMap = new Map([ [100, 5], [150, 6] ]); -let game = new GameMulti("bo jeu", require('bob_party/assets/ImagesJeux/blackjack.jpg'), "super jeu", 1, myMap); +let game = new GameMulti("bo jeu", require('bob_party/assets/ImagesJeux/blackjack.jpg'), "super jeu", 1, 5, myMap); // Get tests @@ -23,7 +23,10 @@ describe('GameMuti get tests', () => { expect(game.getGameSource()).toBe('super jeu'); }) it('should return 1', () => { - expect(game.getNbPlayer()).toBe(1); + expect(game.getNbPlayerMin()).toBe(1); + }) + it('should return 5', () => { + expect(game.getNbPlayerMax()).toBe(5); }) it('should return myMap', () => { expect(game.getMultiMap()).toBe(myMap); @@ -35,7 +38,8 @@ describe('GameMuti get tests', () => { game.setGameSource('trop cool le jeu'); game.setImageSource(require('bob_party/assets/ImagesJeux/JeuDeDame.jpg')); game.setName('beau jeu'); -game.setNbPlayer(2); +game.setNbPlayerMin(2); +game.setNbPlayerMax(4); // Set tests @@ -50,6 +54,9 @@ describe('GameMulti set tests', () => { expect(game.getGameSource()).toBe('trop cool le jeu'); }) it('should return trop cool le jeu', () => { - expect(game.getNbPlayer()).toBe(2); + expect(game.getNbPlayerMin()).toBe(2); + }) + it('should return 4', () => { + expect(game.getNbPlayerMin()).toBe(4); }) }) \ No newline at end of file diff --git a/bob_party/src/core/tests/gameSolo.test.ts b/bob_party/src/core/tests/gameSolo.test.ts index 2cef7a8..10e9c87 100644 --- a/bob_party/src/core/tests/gameSolo.test.ts +++ b/bob_party/src/core/tests/gameSolo.test.ts @@ -8,7 +8,7 @@ let myMap = new Map([ [100, 5], [150, 6] ]); -let game=new GameSolo("bo jeu", require('bob_party/assets/ImagesJeux/blackjack.jpg'), "super jeu", 1, myMap); +let game=new GameSolo("bo jeu", require('bob_party/assets/ImagesJeux/blackjack.jpg'), "super jeu", 1, 1, myMap); // Get tests @@ -23,7 +23,10 @@ describe('GameSolo get tests', () => { expect(game.getGameSource()).toBe('super jeu'); }) it('should return 1', () => { - expect(game.getNbPlayer()).toBe(1); + expect(game.getNbPlayerMin()).toBe(1); + }) + it('should return 1', () => { + expect(game.getNbPlayerMax()).toBe(1); }) it('should return myMap', () => { expect(game.getSoloMap()).toBe(myMap); @@ -35,7 +38,8 @@ describe('GameSolo get tests', () => { game.setGameSource('trop cool le jeu'); game.setImageSource(require('bob_party/assets/ImagesJeux/JeuDeDame.jpg')); game.setName('beau jeu'); -game.setNbPlayer(2); +game.setNbPlayerMin(2); +game.setNbPlayerMax(3); // Set tests @@ -49,7 +53,10 @@ describe('GameSolo set tests', () => { it('should return trop cool le jeu', () => { expect(game.getGameSource()).toBe('trop cool le jeu'); }) - it('should return trop cool le jeu', () => { - expect(game.getNbPlayer()).toBe(2); + it('should return 2', () => { + expect(game.getNbPlayerMin()).toBe(2); + }) + it('should return 3', () => { + expect(game.getNbPlayerMax()).toBe(3); }) }) \ No newline at end of file diff --git a/bob_party/src/core/tests/match.test.ts b/bob_party/src/core/tests/match.test.ts new file mode 100644 index 0000000..3a561e8 --- /dev/null +++ b/bob_party/src/core/tests/match.test.ts @@ -0,0 +1,3 @@ +import { Match } from '../Match'; + + diff --git a/bob_party/src/core/tests/matchSolo.test.ts b/bob_party/src/core/tests/matchSolo.test.ts new file mode 100644 index 0000000..a85962f --- /dev/null +++ b/bob_party/src/core/tests/matchSolo.test.ts @@ -0,0 +1,56 @@ +import { MatchSolo } from '../MatchSolo'; +import { Conversation } from '../Conversation'; +import { Skin } from '../Skin'; +import { User } from '../User/user'; +import { GameSolo } from '../GameSolo'; + + + +// Instances +let classique = new Skin("S0001", "Bob", require('bob_party/assets/BobsSkins/BobClassic.png'), 0); +let blue = new Skin("S0002", "Bob Blue", require('bob_party/assets/BobsSkins/BobBlue.png'), 100); +let tab:Skin[] = [classique, blue]; +let dateBirth = new Date(2010,0o3,0o7); +let conv:Conversation[] = []; +let usr = new User('00001', 'Killyan', 'password', 'France', 'M', dateBirth, 0, 0, 0, classique, tab, conv); +let tabU:User[] = [usr]; +let myMap = new Map([ + [50, 3], + [75, 4], + [100, 5], + [150, 6] +]); +let game=new GameSolo("bo jeu", require('bob_party/assets/ImagesJeux/blackjack.jpg'), "super jeu", 1, 1, myMap); +let match = new MatchSolo("machin", tabU, game); +let tabU2:User[] = []; +let game2 = new GameSolo("jeu magnifique", require('bob_party/assets/ImagesJeux/blackjack.jpg'), "wow jeu", 1, 1, myMap) + + +// Get tests +describe('Match get tests', () => { + it('should return machin', () => { + expect(match.getCode()).toBe('machin'); + }) + it('should return tabU [usr] (users)', () => { + expect(match.getTabUsers()).toBe(tabU); + }) + it('should return game', () => { + expect(match.getGame).toBe(game); + }) +}) + + +// Setting new values +match.setGame(game2); +match.setTabUser(tabU2); + + +// Set tests +describe('Match set tests', () => { + it('should return tabU2 [] (users)', () => { + expect(match.getTabUsers()).toBe(tabU2); + }) + it('should return game2', () => { + expect(match.getGame).toBe(game2); + }) +}) \ No newline at end of file