parent
aa5674cf82
commit
2edac6db74
@ -0,0 +1,52 @@
|
|||||||
|
import { Conversation } from '../Conversation';
|
||||||
|
import { Message } from '../Message';
|
||||||
|
import { User } from '../User';
|
||||||
|
import { Skin } from '../Skin';
|
||||||
|
|
||||||
|
|
||||||
|
// Instances
|
||||||
|
let conv:Conversation[] = [];
|
||||||
|
let tab:Skin[] = [];
|
||||||
|
let classique = new Skin("S0001", "Bob", require('bob_party/assets/BobsSkins/BobClassic.png'), 0);
|
||||||
|
let dateBirth = new Date(2010,0o3,0o7);
|
||||||
|
let usr = new User('00001', 'Killyan', 'password', 'France', 'M', dateBirth, 0, 0, 0, classique, tab, conv);
|
||||||
|
let usr2 = new User('00002', 'Karina', '1234', 'France', 'F', dateBirth, 5, 6, 8, classique, tab, conv);
|
||||||
|
let theDate = new Date(2022,10,14);
|
||||||
|
let theDate2 = new Date(2022,10,13);
|
||||||
|
let theDate3 = new Date(2022,10,15);
|
||||||
|
let mess = new Message('Bob Party est le meilleur projet', usr, theDate2);
|
||||||
|
let tabU:User[] = [usr, usr2];
|
||||||
|
let mess2 = new Message('Oui tout à fait', usr2, theDate);
|
||||||
|
let mess3 = new Message('Mais oui trop de ouf', usr, theDate3);
|
||||||
|
let tabM:Message[] = [mess, mess2];
|
||||||
|
let convo = new Conversation(tabU, tabM, 'the conv');
|
||||||
|
let usr3 = new User('00003', 'wow', 'password', 'France', 'M', dateBirth, 0, 0, 0, classique, tab, conv);
|
||||||
|
|
||||||
|
|
||||||
|
// Get tests
|
||||||
|
describe('Conversation get tests', () => {
|
||||||
|
it('should return tabU [usr, usr2] (users)', () => {
|
||||||
|
expect(convo.getTabUser()).toBe(tabU);
|
||||||
|
})
|
||||||
|
it('should return tabM [mess, mess2] (messages)', () => {
|
||||||
|
expect(convo.getTabMessage()).toBe(tabM);
|
||||||
|
})
|
||||||
|
it('should return the conv', () => {
|
||||||
|
expect(convo.getName()).toBe('the conv');
|
||||||
|
})
|
||||||
|
it('should return Oui tout à fait (mess2)', () => {
|
||||||
|
expect(convo.getLastMessage()).toBe('Oui tout à fait');
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
// Setting new value
|
||||||
|
convo.setName('THE conv');
|
||||||
|
|
||||||
|
|
||||||
|
// Set test
|
||||||
|
describe('Conversation set test', () => {
|
||||||
|
it('should return THE conv', () => {
|
||||||
|
expect(convo.setName).toBe('THE conv');
|
||||||
|
})
|
||||||
|
})
|
@ -0,0 +1,55 @@
|
|||||||
|
import { GameMulti } from '../gameMulti';
|
||||||
|
|
||||||
|
|
||||||
|
// Instances
|
||||||
|
let myMap = new Map<number, number>([
|
||||||
|
[50, 3],
|
||||||
|
[75, 4],
|
||||||
|
[100, 5],
|
||||||
|
[150, 6]
|
||||||
|
]);
|
||||||
|
let game = new GameMulti("bo jeu", require('bob_party/assets/ImagesJeux/blackjack.jpg'), "super jeu", 1, myMap);
|
||||||
|
|
||||||
|
|
||||||
|
// 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.getNbPlayer()).toBe(1);
|
||||||
|
})
|
||||||
|
it('should return myMap', () => {
|
||||||
|
expect(game.getMultiMap()).toBe(myMap);
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
// Setting new values
|
||||||
|
game.setGameSource('trop cool le jeu');
|
||||||
|
game.setImageSource(require('bob_party/assets/ImagesJeux/JeuDeDame.jpg'));
|
||||||
|
game.setName('beau jeu');
|
||||||
|
game.setNbPlayer(2);
|
||||||
|
|
||||||
|
|
||||||
|
// Set tests
|
||||||
|
describe('GameMulti 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.getNbPlayer()).toBe(2);
|
||||||
|
})
|
||||||
|
})
|
@ -0,0 +1,55 @@
|
|||||||
|
import { GameSolo } from '../GameSolo';
|
||||||
|
|
||||||
|
|
||||||
|
// Instances
|
||||||
|
let myMap = new Map<number, number>([
|
||||||
|
[50, 3],
|
||||||
|
[75, 4],
|
||||||
|
[100, 5],
|
||||||
|
[150, 6]
|
||||||
|
]);
|
||||||
|
let game=new GameSolo("bo jeu", require('bob_party/assets/ImagesJeux/blackjack.jpg'), "super jeu", 1, myMap);
|
||||||
|
|
||||||
|
|
||||||
|
// Get tests
|
||||||
|
describe('GameSolo 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.getNbPlayer()).toBe(1);
|
||||||
|
})
|
||||||
|
it('should return myMap', () => {
|
||||||
|
expect(game.getSoloMap()).toBe(myMap);
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
// Setting new values
|
||||||
|
game.setGameSource('trop cool le jeu');
|
||||||
|
game.setImageSource(require('bob_party/assets/ImagesJeux/JeuDeDame.jpg'));
|
||||||
|
game.setName('beau jeu');
|
||||||
|
game.setNbPlayer(2);
|
||||||
|
|
||||||
|
|
||||||
|
// Set tests
|
||||||
|
describe('GameSolo 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.getNbPlayer()).toBe(2);
|
||||||
|
})
|
||||||
|
})
|
@ -0,0 +1,49 @@
|
|||||||
|
import { Message } from '../Message';
|
||||||
|
import { User } from '../User';
|
||||||
|
import { Conversation } from '../Conversation';
|
||||||
|
import { Skin } from '../Skin';
|
||||||
|
|
||||||
|
// Instances
|
||||||
|
let conv:Conversation[] = [];
|
||||||
|
let tab:Skin[] = [];
|
||||||
|
let classique = new Skin("S0001", "Bob", require('bob_party/assets/BobsSkins/BobClassic.png'), 0);
|
||||||
|
let dateBirth = new Date(2010,0o3,0o7);
|
||||||
|
let usr = new User('00001', 'Killyan', 'password', 'France', 'M', dateBirth, 0, 0, 0, classique, tab, conv);
|
||||||
|
let usr2 = new User('00002', 'Karina', '1234', 'France', 'F', dateBirth, 5, 6, 8, classique, tab, conv);
|
||||||
|
let theDate = new Date(2022,10,14);
|
||||||
|
let theDate2 = new Date(2022,10,13);
|
||||||
|
let mess = new Message('Bob Party est le meilleur projet', usr, theDate);
|
||||||
|
|
||||||
|
|
||||||
|
// Get tests
|
||||||
|
describe('Message get tests', () => {
|
||||||
|
it('should return Bob Party est le meilleur projet', () => {
|
||||||
|
expect(mess.getMessageContent()).toBe('Bob Party est le meilleur projet');
|
||||||
|
})
|
||||||
|
it('should return usr', () => {
|
||||||
|
expect(mess.getMessageSender()).toBe(usr);
|
||||||
|
})
|
||||||
|
it('should return wouhou', () => {
|
||||||
|
expect(mess.getMessageDate()).toBe(theDate);
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
// Setting new values
|
||||||
|
mess.setMessageContent('Vive Bob Party');
|
||||||
|
mess.setMessageSender(usr2);
|
||||||
|
mess.setMessageDate(theDate2);
|
||||||
|
|
||||||
|
|
||||||
|
// Set tests
|
||||||
|
describe('Message set tests', () => {
|
||||||
|
it('should return Vive Bob Party', () => {
|
||||||
|
expect(mess.getMessageContent()).toBe('Vive Bob Party');
|
||||||
|
})
|
||||||
|
it('should return usr2', () => {
|
||||||
|
expect(mess.getMessageSender()).toBe(usr2);
|
||||||
|
})
|
||||||
|
it('should return theDate2', () => {
|
||||||
|
expect(mess.getMessageDate()).toBe(theDate2);
|
||||||
|
})
|
||||||
|
})
|
@ -0,0 +1,50 @@
|
|||||||
|
import { Skin } from '../Skin';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Instance
|
||||||
|
|
||||||
|
let classique = new Skin("S0001", "Bob", require('bob_party/assets/BobsSkins/BobClassic.png'), 0);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Get tests
|
||||||
|
|
||||||
|
describe('Skin get tests', () => {
|
||||||
|
it('should return S0001', () => {
|
||||||
|
expect(classique.getSkinId()).toBe('S0001');
|
||||||
|
})
|
||||||
|
it('should return Bob', () => {
|
||||||
|
expect(classique.getSkinName()).toBe('Bob');
|
||||||
|
})
|
||||||
|
it('should return require(BobClassic.png)', () => {
|
||||||
|
expect(classique.getSkinSource()).toBe(require('bob_party/assets/BobsSkins/BobClassic.png'));
|
||||||
|
})
|
||||||
|
it('should return 0', () => {
|
||||||
|
expect(classique.getSkinCost()).toBe(0);
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Setting new values
|
||||||
|
|
||||||
|
classique.setSkinName('Bob Blue');
|
||||||
|
classique.setSkinCost(100);
|
||||||
|
classique.setSkinSource(require('bob_party/assets/BobsSkins/BobBlue.png'));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Set tests
|
||||||
|
|
||||||
|
describe('Skin set tests', () => {
|
||||||
|
it('should return The Classique', () => {
|
||||||
|
expect(classique.getSkinName()).toBe('Bob blue');
|
||||||
|
})
|
||||||
|
it('should return require(BobBlue.png)', () => {
|
||||||
|
expect(classique.getSkinSource()).toBe(require('bob_party/assets/BobsSkins/BobBlue.png'));
|
||||||
|
})
|
||||||
|
it('should return 100', () => {
|
||||||
|
expect(classique.getSkinCost()).toBe(0);
|
||||||
|
})
|
||||||
|
})
|
@ -0,0 +1,108 @@
|
|||||||
|
import { User } from '../User';
|
||||||
|
import { Skin } from '../Skin';
|
||||||
|
import { Conversation } from '../Conversation';
|
||||||
|
|
||||||
|
|
||||||
|
// 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[] = [];
|
||||||
|
let tab2:Skin[] = [classique, blue];
|
||||||
|
let dateBirth = new Date(2010,0o3,0o7);
|
||||||
|
let dateBirth2 = new Date(2009,0o3,0o7);
|
||||||
|
let conv:Conversation[] = [];
|
||||||
|
let conv2:Conversation[] = [];
|
||||||
|
let usr = new User('00001', 'Killyan', 'password', 'France', 'M', dateBirth, 0, 0, 0, classique, tab, conv);
|
||||||
|
|
||||||
|
|
||||||
|
// Tests des get
|
||||||
|
describe('User get tests', () => {
|
||||||
|
it('should return 00001', () => {
|
||||||
|
expect(usr.getId()).toBe('00001');
|
||||||
|
})
|
||||||
|
it('should return Killyan', () => {
|
||||||
|
expect(usr.getUsername()).toBe('Killyan');
|
||||||
|
})
|
||||||
|
it('should return password', () => {
|
||||||
|
expect(usr.getPassword()).toBe('password');
|
||||||
|
})
|
||||||
|
it('should return France', () => {
|
||||||
|
expect(usr.getNationality()).toBe('France');
|
||||||
|
})
|
||||||
|
it('should return M', () => {
|
||||||
|
expect(usr.getSexe()).toBe('M');
|
||||||
|
})
|
||||||
|
it('should return 2010-03-07 (dateBirth)', () => {
|
||||||
|
expect(usr.getDateOfBirth()).toBe(dateBirth);
|
||||||
|
})
|
||||||
|
it('should return 0', () => {
|
||||||
|
expect(usr.getCurrentCoins()).toBe(0);
|
||||||
|
})
|
||||||
|
it('should return 0', () => {
|
||||||
|
expect(usr.getTotalCoins()).toBe(0);
|
||||||
|
})
|
||||||
|
it('should return 0', () => {
|
||||||
|
expect(usr.getGamePlayed()).toBe(0);
|
||||||
|
})
|
||||||
|
it('should return classique', () => {
|
||||||
|
expect(usr.getCurrentSkin()).toBe(classique);
|
||||||
|
})
|
||||||
|
it('should return tab', () => {
|
||||||
|
expect(usr.getTabSkin()).toBe(tab);
|
||||||
|
})
|
||||||
|
it('should return conv', () => {
|
||||||
|
expect(usr.getTabConv()).toBe(conv);
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
// Set de nouvelles valeurs
|
||||||
|
usr.setUsername('BgKillyan');
|
||||||
|
usr.setPassword('1234');
|
||||||
|
usr.setNationality('Marseille');
|
||||||
|
usr.setSexe('F');
|
||||||
|
usr.setDateOfBirth(dateBirth2);
|
||||||
|
usr.setCurrentCoins(2);
|
||||||
|
usr.setTotalCoins(2);
|
||||||
|
usr.setGamePlayed(4);
|
||||||
|
usr.setCurrentSkin(blue);
|
||||||
|
usr.setTabSkin(tab2);
|
||||||
|
usr.setTabConv(conv2);
|
||||||
|
|
||||||
|
|
||||||
|
// Tests des set
|
||||||
|
describe('User get tests', () => {
|
||||||
|
it('should return BgKillyan', () => {
|
||||||
|
expect(usr.getUsername()).toBe('BgKillyan');
|
||||||
|
})
|
||||||
|
it('should return 1234', () => {
|
||||||
|
expect(usr.getPassword()).toBe('1234');
|
||||||
|
})
|
||||||
|
it('should return Marseille', () => {
|
||||||
|
expect(usr.getNationality()).toBe('Marseille');
|
||||||
|
})
|
||||||
|
it('should return F', () => {
|
||||||
|
expect(usr.getSexe()).toBe('F');
|
||||||
|
})
|
||||||
|
it('should return 07/03/2009 (dateBirth2)', () => {
|
||||||
|
expect(usr.getDateOfBirth()).toBe(dateBirth2);
|
||||||
|
})
|
||||||
|
it('should return 2', () => {
|
||||||
|
expect(usr.getCurrentCoins()).toBe(2);
|
||||||
|
})
|
||||||
|
it('should return 2', () => {
|
||||||
|
expect(usr.getTotalCoins()).toBe(2);
|
||||||
|
})
|
||||||
|
it('should return 4', () => {
|
||||||
|
expect(usr.getGamePlayed()).toBe(4);
|
||||||
|
})
|
||||||
|
it('should return kikou', () => {
|
||||||
|
expect(usr.getCurrentSkin()).toBe(blue);
|
||||||
|
})
|
||||||
|
it('should return tab2', () => {
|
||||||
|
expect(usr.getTabSkin()).toBe(tab2);
|
||||||
|
})
|
||||||
|
it('should return conv2', () => {
|
||||||
|
expect(usr.getTabConv()).toBe(conv2);
|
||||||
|
})
|
||||||
|
})
|
Loading…
Reference in new issue