Skip to content

Commit

Permalink
completed writing test for user model - 2 unit tests complete for pro…
Browse files Browse the repository at this point in the history
…ject
  • Loading branch information
sarahlessner committed Aug 25, 2017
1 parent 0753685 commit d7a2984
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 16 deletions.
2 changes: 1 addition & 1 deletion test/skills_model_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
var expect = require("chai").expect;
var Skill = require("../models/skills.js");

// console.log(Skill().skill_name);
//object like my users/skills model object
var testSkill = {
skill_name: "skill"
}
Expand Down
43 changes: 28 additions & 15 deletions test/users_model_test.js
Original file line number Diff line number Diff line change
@@ -1,32 +1,45 @@

var expect = require("chai").expect;
var Skill = require("../models/users.js");
var User = require("../models/users.js");

// console.log(Skill().skill_name);
//object like my users/skills model object
var testUser = {
name: "skill",
email: "email@email.com",
photo: "www.mypicture.com"
name: "name",
email: "email@email.com"
}

describe("skill", function() {
describe("user", function() {

it("should have a skill name", function(){
expect(testSkill.skill_name).to.equal("skill");
it("should have a name", function(){
expect(testUser.name).to.equal("name");
});

it("should have the name as a string", function(){
expect(typeof testUser.name).to.equal("string");
});

it("should not permit null in the name field", function(){
expect(testUser.name).to.not.equal(null);
});

// it("should check for valid email format", function(){
// expect(testUser.email).to.equal();
// });

it("should have an email", function(){
expect(testUser.email).to.equal("email@email.com");
});

it("should be a string", function(){
expect(typeof testSkill.skill_name).to.equal("string");
it("should have the email as a string", function(){
expect(typeof testUser.email).to.equal("string");
});

it("should not be null", function(){
expect(testSkill.skill_name).to.not.equal(null);
it("should not permit null in the email field", function(){
expect(testUser.email).to.not.equal(null);
});

it("to be a type of function", function() {

expect(typeof Skill).to.equal("function");
it("the model, should be a type of function", function() {
expect(typeof User).to.equal("function");
});

});

0 comments on commit d7a2984

Please sign in to comment.