Skip to content
This repository has been archived by the owner on Jun 3, 2020. It is now read-only.

Commit

Permalink
added game scores test
Browse files Browse the repository at this point in the history
  • Loading branch information
jaebradley committed May 22, 2016
1 parent 28172e1 commit 5c4504f
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
4 changes: 2 additions & 2 deletions test/GameMetadata.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ describe('game metadata model', function() {
expect(defaultMetadata.broadcasts.length).to.equal(0);
expect(defaultMetadata.getBroadcastsString()).to.equal('');
expect(defaultMetadata.getNbaStatsFormattedStartDate()).to.equal('19691231');
expect(defaultMetadata.getLocalizedStartDateTime()).to.equal('December 31, 1969 7:00 PM');
expect(defaultMetadata.getLocalizedStartDateTime()).to.equal('January 1, 1970 12:00 AM'); // Travis CI in UTC
expect(defaultMetadata.isUpcoming()).to.equal(false);

expect(customMetadata.unixMillisecondsStartTime).to.equal(1451606400000);
expect(customMetadata.getNbaStatsFormattedStartDate()).to.equal('20151231');
expect(customMetadata.getLocalizedStartDateTime()).to.equal('December 31, 2015 7:00 PM');
expect(customMetadata.getLocalizedStartDateTime()).to.equal('January 1, 2016 12:00 AM');
expect(customMetadata.isUpcoming()).to.equal(false);
expect(customMetadata.getBroadcastsString()).to.equal('TNT,NBATV');

Expand Down
29 changes: 29 additions & 0 deletions test/GameScores.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
'use es6';

import {expect} from 'chai';
import GameScores from '../src/data/models/GameScores';
import PeriodScore from '../src/data/models/PeriodScore';
import Score from '../src/data/models/Score';

describe('Game scores model', function() {
it('creates game scores model', function() {
const defaultGameScores = new GameScores();

expect(defaultGameScores.periodScores).to.eql([]);
expect(defaultGameScores.totalScore.homeScore).to.equal(0);
expect(defaultGameScores.totalScore.visitorScore).to.equal(0);
});

it('get period values', function() {
const periodScores = [
new PeriodScore({periodValue: 1, score: new Score({homeScore: 2, visitorScore: 3})}),
new PeriodScore({periodValue: 4, score: new Score({homeScore: 5, visitorScore: 6})}),
new PeriodScore({periodValue: 7, score: new Score({homeScore: 8, visitorScore: 9})}),
];
const customPeriodScores = new GameScores({
periodScores: periodScores,
});

expect(customPeriodScores.getPeriodValues()).to.eql([1, 4, 7]);
});
});

0 comments on commit 5c4504f

Please sign in to comment.