|
|
@ -4,19 +4,19 @@ import { Skin } from '../Skin';
|
|
|
|
|
|
|
|
|
|
|
|
// Instances
|
|
|
|
// Instances
|
|
|
|
const img = "";
|
|
|
|
const img = "";
|
|
|
|
let classique = new Skin("S0001", "Bob", img, 0);
|
|
|
|
let classique = new Skin(1, "Bob", img, 0);
|
|
|
|
let blue = new Skin("S0002", "Bob Blue", img, 100);
|
|
|
|
let blue = new Skin(2, "Bob Blue", img, 100);
|
|
|
|
let tab:Skin[] = [];
|
|
|
|
let tab:Skin[] = [];
|
|
|
|
let tab2:Skin[] = [classique, blue];
|
|
|
|
let tab2:Skin[] = [classique, blue];
|
|
|
|
let dateBirth = new Date(2010,0o3,0o7);
|
|
|
|
let dateBirth = new Date(2010,0o3,0o7);
|
|
|
|
let dateBirth2 = new Date(2009,0o3,0o7);
|
|
|
|
let dateBirth2 = new Date(2009,0o3,0o7);
|
|
|
|
let usr = new User('00001', 'Killyan', 'password', 'France', 'M', dateBirth, 0, 0, 0, classique, tab);
|
|
|
|
let usr = new User(1, 'Killyan', 'password', 'France', 'M', dateBirth, 0, 0, 0, classique, tab);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Tests des get
|
|
|
|
// Tests des get
|
|
|
|
describe('User get tests', () => {
|
|
|
|
describe('User get tests', () => {
|
|
|
|
it('should return 00001', () => {
|
|
|
|
it('should return 1', () => {
|
|
|
|
expect(usr.getId()).toBe('00001');
|
|
|
|
expect(usr.getId()).toBe(1);
|
|
|
|
})
|
|
|
|
})
|
|
|
|
it('should return Killyan', () => {
|
|
|
|
it('should return Killyan', () => {
|
|
|
|
expect(usr.getUsername()).toBe('Killyan');
|
|
|
|
expect(usr.getUsername()).toBe('Killyan');
|
|
|
@ -31,7 +31,7 @@ describe('User get tests', () => {
|
|
|
|
expect(usr.getSexe()).toBe('M');
|
|
|
|
expect(usr.getSexe()).toBe('M');
|
|
|
|
})
|
|
|
|
})
|
|
|
|
it('should return 2010-03-07 (dateBirth)', () => {
|
|
|
|
it('should return 2010-03-07 (dateBirth)', () => {
|
|
|
|
expect(usr.getDateOfBirth()).toBe(dateBirth);
|
|
|
|
expect(usr.getDateOfBirth()).toEqual(dateBirth);
|
|
|
|
})
|
|
|
|
})
|
|
|
|
it('should return 0', () => {
|
|
|
|
it('should return 0', () => {
|
|
|
|
expect(usr.getCurrentCoins()).toBe(0);
|
|
|
|
expect(usr.getCurrentCoins()).toBe(0);
|
|
|
@ -43,57 +43,54 @@ describe('User get tests', () => {
|
|
|
|
expect(usr.getGamesPlayed()).toBe(0);
|
|
|
|
expect(usr.getGamesPlayed()).toBe(0);
|
|
|
|
})
|
|
|
|
})
|
|
|
|
it('should return classique', () => {
|
|
|
|
it('should return classique', () => {
|
|
|
|
expect(usr.getCurrentSkin()).toBe(classique);
|
|
|
|
expect(usr.getCurrentSkin()).toEqual(classique);
|
|
|
|
})
|
|
|
|
})
|
|
|
|
it('should return tab', () => {
|
|
|
|
it('should return tab', () => {
|
|
|
|
expect(usr.getTabSkin()).toBe(tab);
|
|
|
|
expect(usr.getTabSkin()).toEqual(tab);
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 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.setGamesPlayed(4);
|
|
|
|
|
|
|
|
usr.setCurrentSkin(blue);
|
|
|
|
|
|
|
|
usr.setTabSkin(tab2);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Tests des set
|
|
|
|
// Tests des set
|
|
|
|
describe('User get tests', () => {
|
|
|
|
describe('User get tests', () => {
|
|
|
|
it('should return BgKillyan', () => {
|
|
|
|
it('should return BgKillyan', () => {
|
|
|
|
|
|
|
|
usr.setUsername('BgKillyan');
|
|
|
|
expect(usr.getUsername()).toBe('BgKillyan');
|
|
|
|
expect(usr.getUsername()).toBe('BgKillyan');
|
|
|
|
})
|
|
|
|
})
|
|
|
|
it('should return 1234', () => {
|
|
|
|
it('should return 1234', () => {
|
|
|
|
|
|
|
|
usr.setPassword('1234');
|
|
|
|
expect(usr.getPassword()).toBe('1234');
|
|
|
|
expect(usr.getPassword()).toBe('1234');
|
|
|
|
})
|
|
|
|
})
|
|
|
|
it('should return Marseille', () => {
|
|
|
|
it('should return Marseille', () => {
|
|
|
|
|
|
|
|
usr.setNationality('Marseille');
|
|
|
|
expect(usr.getNationality()).toBe('Marseille');
|
|
|
|
expect(usr.getNationality()).toBe('Marseille');
|
|
|
|
})
|
|
|
|
})
|
|
|
|
it('should return F', () => {
|
|
|
|
it('should return F', () => {
|
|
|
|
|
|
|
|
usr.setSexe('F');
|
|
|
|
expect(usr.getSexe()).toBe('F');
|
|
|
|
expect(usr.getSexe()).toBe('F');
|
|
|
|
})
|
|
|
|
})
|
|
|
|
it('should return 07/03/2009 (dateBirth2)', () => {
|
|
|
|
it('should return 07/03/2009 (dateBirth2)', () => {
|
|
|
|
expect(usr.getDateOfBirth()).toBe(dateBirth2);
|
|
|
|
usr.setDateOfBirth(dateBirth2);
|
|
|
|
|
|
|
|
expect(usr.getDateOfBirth()).toEqual(dateBirth2);
|
|
|
|
})
|
|
|
|
})
|
|
|
|
it('should return 2', () => {
|
|
|
|
it('should return 2', () => {
|
|
|
|
|
|
|
|
usr.setCurrentCoins(2);
|
|
|
|
expect(usr.getCurrentCoins()).toBe(2);
|
|
|
|
expect(usr.getCurrentCoins()).toBe(2);
|
|
|
|
})
|
|
|
|
})
|
|
|
|
it('should return 2', () => {
|
|
|
|
it('should return 2', () => {
|
|
|
|
|
|
|
|
usr.setTotalCoins(2);
|
|
|
|
expect(usr.getTotalCoins()).toBe(2);
|
|
|
|
expect(usr.getTotalCoins()).toBe(2);
|
|
|
|
})
|
|
|
|
})
|
|
|
|
it('should return 4', () => {
|
|
|
|
it('should return 4', () => {
|
|
|
|
|
|
|
|
usr.setGamesPlayed(4);
|
|
|
|
expect(usr.getGamesPlayed()).toBe(4);
|
|
|
|
expect(usr.getGamesPlayed()).toBe(4);
|
|
|
|
})
|
|
|
|
})
|
|
|
|
it('should return kikou', () => {
|
|
|
|
it('should return kikou', () => {
|
|
|
|
expect(usr.getCurrentSkin()).toBe(blue);
|
|
|
|
usr.setCurrentSkin(blue);
|
|
|
|
|
|
|
|
expect(usr.getCurrentSkin()).toEqual(blue);
|
|
|
|
})
|
|
|
|
})
|
|
|
|
it('should return tab2', () => {
|
|
|
|
it('should return tab2', () => {
|
|
|
|
expect(usr.getTabSkin()).toBe(tab2);
|
|
|
|
usr.setTabSkin(tab2);
|
|
|
|
|
|
|
|
expect(usr.getTabSkin()).toEqual(tab2);
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|