This repository has been archived by the owner on Jun 3, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
87 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
'use es6'; | ||
|
||
export default class PeriodFormatter { | ||
static format(period) { | ||
return period > 4 | ||
? `OT${period - 4}` | ||
: `Q${period}`; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
'use es6'; | ||
|
||
import chai from 'chai'; | ||
import chaiImmutable from 'chai-immutable'; | ||
import {List} from 'immutable'; | ||
|
||
import GameScoring from '../src/data/GameScoring'; | ||
import PeriodScore from '../src/data/PeriodScore'; | ||
import Score from '../src/data/Score'; | ||
|
||
chai.use(chaiImmutable); | ||
|
||
let expect = chai.expect; | ||
|
||
describe('Game Scoring Test', function() { | ||
let periodScore = new PeriodScore({ | ||
period: 1, | ||
score: new Score({ | ||
home: 2, | ||
away: 3 | ||
}) | ||
}); | ||
let periods = List.of(periodScore, periodScore); | ||
let gameScoring = new GameScoring({ | ||
periods: periods | ||
}); | ||
it('should get period values', function() { | ||
let expected = List.of('Q1', 'Q1'); | ||
expect(gameScoring.getPeriodValues()).to.eql(expected); | ||
}) | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
'use es6'; | ||
|
||
import {expect} from 'chai'; | ||
|
||
import PeriodFormatter from '../src/services/PeriodFormatter'; | ||
|
||
describe('Test Period Formatter', function() { | ||
it('should test period formatting', function() { | ||
expect(PeriodFormatter.format(1)).to.equal('Q1'); | ||
expect(PeriodFormatter.format(5)).to.equal('OT1'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
'use es6'; | ||
|
||
import {expect} from 'chai'; | ||
|
||
import PeriodScore from '../src/data/PeriodScore'; | ||
import Score from '../src/data/Score'; | ||
|
||
describe('Period Score Test', function() { | ||
let overtimePeriod = new PeriodScore({ | ||
period: 5, | ||
}); | ||
let nonOvertimePeriod = new PeriodScore({ | ||
period: 2 | ||
}); | ||
it('should test period score formatting', function() { | ||
expect(overtimePeriod.formatPeriod()).to.equal('OT1'); | ||
expect(nonOvertimePeriod.formatPeriod()).to.equal('Q2'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters