-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into yildirim_wip
- Loading branch information
Showing
1 changed file
with
21 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
*/ | ||
|
||
"use strict"; | ||
const should = require("should"); | ||
const helperIntegrationTests = require("./_helpers"); | ||
|
||
describe("Student model", function() { | ||
|
@@ -14,11 +15,11 @@ describe("Student model", function() { | |
let testStudent = { | ||
username: "[email protected]", | ||
firstName: "TEST", | ||
lastName: "STUDENT", | ||
lastName: "STUDENT", | ||
academicRank: "Freshman", | ||
residentialStatus: "On campus" | ||
}; | ||
|
||
let testFallSport = { name: "TEST FALL SPORT" }; | ||
let testSpringSport = { name: "TEST SPRING SPORT" }; | ||
let testMajorOne = { name: "TEST MAJOR ONE" }; | ||
|
@@ -51,11 +52,27 @@ describe("Student model", function() { | |
|
||
// Run helper integration tests | ||
helperIntegrationTests("student", testData); | ||
|
||
|
||
context("A data record returned by `create()`", function() { | ||
it("should have a field for each model attribute", function() { | ||
for (let property in testStudent) { | ||
testData.record.should.have.property(property); | ||
} | ||
|
||
for (let property in testData.associations) { | ||
testData.record.should.have.property(property); | ||
} | ||
}); | ||
|
||
it("should have correct default field values", function() { | ||
testData.record.forceUpdate.should.be.true(); | ||
}); | ||
}); | ||
|
||
async function destroyTestData() { | ||
// Destroy main test record | ||
await Student.destroyOne({ username: testStudent.username }); | ||
|
||
// Destroy test records in associated model | ||
await FallSport.destroyOne({ name: testFallSport.name }); | ||
await SpringSport.destroyOne({ name: testSpringSport.name }); | ||
|