Created
June 7, 2019 22:43
-
-
Save judytuna/50e8a78629767cff988d5e767dc6449e to your computer and use it in GitHub Desktop.
starter code for adding a spec file in https://github.com/Techtonica/curriculum/blob/master/javascript/event-recommender-part2.md
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
describe("EventRecommender", function() { | |
var EventRecommender = require('../app/EventRecommender'); | |
var er; | |
beforeEach(function() { | |
er = new EventRecommender(); | |
}); | |
describe("addEvent", function() { | |
it("adds a new Event to the system", function() { | |
er.addEvent("Change Me"); | |
expect(er.events.length).toEqual(1); | |
expect(er.events[0].title).toEqual("Change Me"); // what are some other things you can test? | |
}); | |
}); | |
describe("addUser", function() { | |
it("adds a new User to the system", function() { | |
er.addUser("Change Me"); | |
expect(er.user.length).toEqual(1); | |
}); | |
}); | |
describe("saveUserEvent", function() { | |
it("adds an event to a user's personal event array", function() { | |
er.addEvent("Make a new event"); | |
er.addUser("Make a new user"); | |
er.saveUserEvent("event", "user"); // change these to match your method signature | |
expect(er.user.personalEvents.length).toEqual(1); | |
}); | |
}); | |
describe("deleteUser", function() { | |
it("removes a User from the system", function() { | |
er.addUser("Make a new user here that you will delete later"); | |
er.deleteUser("Change Me"); | |
expect(er.user.length).toEqual(0); | |
}); | |
}); | |
describe("deleteEvent", function() { | |
it("removes the event from the system", function() { | |
er.addEvent("A new event that you will delete later"); | |
er.deleteEvent("Change Me"); | |
expect(er.events.length).toEqual(0); | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment