Skip to content

Commit

Permalink
Merge pull request #36 from dewv/yildirim_wip
Browse files Browse the repository at this point in the history
Issue 34
  • Loading branch information
tydingsl authored Feb 20, 2019
2 parents e9becc2 + c9f8211 commit 1a54c75
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 2 deletions.
3 changes: 2 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
"FallSport": true,
"SpringSport": true,
"Major": true,
"Student": true
"Student": true,
"Staff": true
// …and any others (e.g. `"Organization": true`)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
},
Expand Down
3 changes: 2 additions & 1 deletion api/models/Staff.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ module.exports = {
username: { type: "string", required: true, allowNull: false, unique: true },
firstName: { type: "string", required: true, allowNull: false },
lastName: { type: "string", required: true, allowNull: false },
isSlpInstructor: { type: "boolean", allowNull: "false", defaultsTo: false }
isSlpInstructor: { type: "boolean", allowNull: "false", defaultsTo: false },
forceUpdate: { type: "boolean", defaultsTo: true }
},

};
Expand Down
47 changes: 47 additions & 0 deletions test/models/Staff.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/**
* @file Defines tests for the Student sailsjs model.
*/

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

describe("Staff model", function() {
let testData = {
associations: {},
record: {}
};

let testStaff = {
username: "[email protected]",
firstName: "TEST",
lastName: "STAFF",
isSlpInstructor: true,
forceUpdate: true,
};

// Before tests run ...
before(async function() {

// Destroy any old test data that might be haning around
await destroyTestData();

// Create test data: associated model records
// Associate, using the new IDs

// Create main test record, with associations in place
testData.record = await Staff.create(testStaff).fetch();
});

// After tests run ...
after(destroyTestData);

// Run helper integration tests
helperIntegrationTests("staff", testData);

async function destroyTestData() {
// Destroy main test record
await Staff.destroyOne({ username: testStaff.username });

// Destroy test records in associated model
}
});

0 comments on commit 1a54c75

Please sign in to comment.