started on the testing for Lineup and Matchup
This commit is contained in:
parent
570853402e
commit
fff6653911
27
test/backend/models_Lineup.spec.js
Normal file
27
test/backend/models_Lineup.spec.js
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
const { expect } = require('chai')
|
||||||
|
const sinon = require('sinon')
|
||||||
|
const Lineup = require('../../app/models/Lineup.model')
|
||||||
|
const { Model } = require('flitter-orm')
|
||||||
|
|
||||||
|
describe('the lineup model', function() {
|
||||||
|
it('should extend Model', function() {
|
||||||
|
expect(new Lineup).to.be.an.instanceOf(Model)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should format the lineup for the API', async function() {
|
||||||
|
const lineup = new lineup({
|
||||||
|
team_id: 'test team id',
|
||||||
|
benched_player_ids: ['test benched player'],
|
||||||
|
starting_players: [{
|
||||||
|
player_id: 'test player id',
|
||||||
|
position: 'QB',
|
||||||
|
}],
|
||||||
|
active: { type: Boolean, default: true},
|
||||||
|
//unsure about above line
|
||||||
|
week_num: '6',
|
||||||
|
})
|
||||||
|
expect(await lineup.to_api()).to.be.eql({
|
||||||
|
//?
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
26
test/backend/models_Matchup.spec.js
Normal file
26
test/backend/models_Matchup.spec.js
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
const { expect } = require('chai')
|
||||||
|
const sinon = require('sinon')
|
||||||
|
const Matchup = require('../../app/models/Matchup.model')
|
||||||
|
const { Model } = require('flitter-orm')
|
||||||
|
|
||||||
|
describe('the matchup model', function() {
|
||||||
|
it('should should extend Model', function() {
|
||||||
|
expect(new Matchup).to.be.an.instanceOf(Model)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should format Matchuo for the API', async function(){
|
||||||
|
const Matchup = new Matchup({
|
||||||
|
home_team_id: 'test home team',
|
||||||
|
visitor_team_id: 'test visitor team',
|
||||||
|
week_num: 4,
|
||||||
|
complete: { type: Boolean, default: false },
|
||||||
|
//not sure about above line
|
||||||
|
home_team_score: 20,
|
||||||
|
visitor_team_score: 21,
|
||||||
|
})
|
||||||
|
expect(await Matchup.to_api()).to.be.eql({
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
})
|
||||||
|
})
|
Loading…
Reference in New Issue
Block a user