From fff6653911da8d71a27fff2887d2d9dde79b8c06 Mon Sep 17 00:00:00 2001 From: Evan Powell Date: Sun, 8 Nov 2020 20:45:06 -0600 Subject: [PATCH] started on the testing for Lineup and Matchup --- test/backend/models_Lineup.spec.js | 27 +++++++++++++++++++++++++++ test/backend/models_Matchup.spec.js | 26 ++++++++++++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 test/backend/models_Lineup.spec.js create mode 100644 test/backend/models_Matchup.spec.js diff --git a/test/backend/models_Lineup.spec.js b/test/backend/models_Lineup.spec.js new file mode 100644 index 0000000..2ddaba9 --- /dev/null +++ b/test/backend/models_Lineup.spec.js @@ -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({ + //? + }) + }) +}) \ No newline at end of file diff --git a/test/backend/models_Matchup.spec.js b/test/backend/models_Matchup.spec.js new file mode 100644 index 0000000..aa16ad9 --- /dev/null +++ b/test/backend/models_Matchup.spec.js @@ -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({ + + }) + + }) +}) \ No newline at end of file