Skip to content

Commit

Permalink
Merge branch 'master' into yildirim_wip
Browse files Browse the repository at this point in the history
  • Loading branch information
JereomyAyres authored Feb 20, 2019
2 parents 00dbd1a + e9becc2 commit c9f8211
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions test/models/Student.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
*/

"use strict";
const should = require("should");
const helperIntegrationTests = require("./_helpers");

describe("Student model", function() {
Expand All @@ -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" };
Expand Down Expand Up @@ -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 });
Expand Down

0 comments on commit c9f8211

Please sign in to comment.