Add tests for photo model
This commit is contained in:
parent
9b07fba5eb
commit
9112d30711
1 changed files with 26 additions and 0 deletions
|
@ -198,4 +198,30 @@ describe("model/photo", () => {
|
|||
assert.equal(result, "Photo");
|
||||
});
|
||||
|
||||
it("should like photo", () => {
|
||||
const values = {ID: 5, PhotoTitle: "Crazy Cat", CountryName: "Africa", PhotoFavorite: false};
|
||||
const photo = new Photo(values);
|
||||
assert.equal(photo.PhotoFavorite, false);
|
||||
photo.like();
|
||||
assert.equal(photo.PhotoFavorite, true);
|
||||
});
|
||||
|
||||
it("should unlike photo", () => {
|
||||
const values = {ID: 5, PhotoTitle: "Crazy Cat", CountryName: "Africa", PhotoFavorite: true};
|
||||
const photo = new Photo(values);
|
||||
assert.equal(photo.PhotoFavorite, true);
|
||||
photo.unlike();
|
||||
assert.equal(photo.PhotoFavorite, false);
|
||||
});
|
||||
|
||||
it("should toggle like", () => {
|
||||
const values = {ID: 5, PhotoTitle: "Crazy Cat", CountryName: "Africa", PhotoFavorite: true};
|
||||
const photo = new Photo(values);
|
||||
assert.equal(photo.PhotoFavorite, true);
|
||||
photo.toggleLike();
|
||||
assert.equal(photo.PhotoFavorite, false);
|
||||
photo.toggleLike();
|
||||
assert.equal(photo.PhotoFavorite, true);
|
||||
});
|
||||
|
||||
});
|
Loading…
Reference in a new issue