Skip to content

Instantly share code, notes, and snippets.

@judytuna
Created June 7, 2019 22:43
Show Gist options
  • Save judytuna/50e8a78629767cff988d5e767dc6449e to your computer and use it in GitHub Desktop.
Save judytuna/50e8a78629767cff988d5e767dc6449e to your computer and use it in GitHub Desktop.
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