-
Notifications
You must be signed in to change notification settings - Fork 275
/
Copy pathchitterModel.test.js
41 lines (36 loc) · 1.09 KB
/
chitterModel.test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
const ChitterModel = require("../src/chitterModel");
describe("ChitterModel", () => {
beforeEach(() => {
model = new ChitterModel();
});
it("returns empty array", () => {
const peeps = model.getPeeps();
expect(peeps).toEqual([]);
});
it("returns two peeps", () => {
model.addPeep("Test peep 1");
model.addPeep("Test peep 2");
expect(model.getPeeps()).toEqual(["Test peep 1", "Test peep 2"]);
});
it("returns the list of notes", () => {
peepsList = model.setPeeps("Test peep 1, Test peep 2");
expect(peepsList).toEqual("Test peep 1, Test peep 2");
});
it("returns the peeps that match the user ID", () => {
const mockPeep1 = {
id: 1,
body: "my first peep",
created_at: "2018-06-23T13:12:29.945Z",
updated_at: "2018-06-23T13:12:29.945Z",
};
const mockPeep2 = {
id: 2,
body: "my second peep",
created_at: "2022-02-23T13:12:29.945Z",
updated_at: "2022-02-23T13:12:29.945Z",
};
model.addPeep(mockPeep1);
model.addPeep(mockPeep2);
expect(model.getPeepById(1)).toEqual(mockPeep1);
});
});