Add tests for album model
This commit is contained in:
parent
7edc441f96
commit
5bd0ffa56c
1 changed files with 27 additions and 1 deletions
|
@ -10,7 +10,7 @@ const postLikeEntity = [
|
|||
];
|
||||
mock.onPost("foo").reply(201, postLikeEntity);
|
||||
|
||||
describe("model/album", () => {
|
||||
describe.only("model/album", () => {
|
||||
it("should get album entity name", () => {
|
||||
const values = {id: 5, AlbumName: "Christmas 2019", AlbumSlug: "christmas-2019"};
|
||||
const album = new Album(values);
|
||||
|
@ -71,6 +71,32 @@ describe("model/album", () => {
|
|||
assert.equal(result, "albums");
|
||||
});
|
||||
|
||||
it("should like album", () => {
|
||||
const values = {id: 5, AlbumName: "Christmas 2019", AlbumSlug: "christmas-2019", AlbumFavorite: false};
|
||||
const album = new Album(values);
|
||||
assert.equal(album.AlbumFavorite, false);
|
||||
album.like();
|
||||
assert.equal(album.AlbumFavorite, true);
|
||||
});
|
||||
|
||||
it("should unlike album", () => {
|
||||
const values = {id: 5, AlbumName: "Christmas 2019", AlbumSlug: "christmas-2019", AlbumFavorite: true};
|
||||
const album = new Album(values);
|
||||
assert.equal(album.AlbumFavorite, true);
|
||||
album.unlike();
|
||||
assert.equal(album.AlbumFavorite, false);
|
||||
});
|
||||
|
||||
it("should toggle like", () => {
|
||||
const values = {id: 5, AlbumName: "Christmas 2019", AlbumSlug: "christmas-2019", AlbumFavorite: true};
|
||||
const album = new Album(values);
|
||||
assert.equal(album.AlbumFavorite, true);
|
||||
album.toggleLike();
|
||||
assert.equal(album.AlbumFavorite, false);
|
||||
album.toggleLike();
|
||||
assert.equal(album.AlbumFavorite, true);
|
||||
});
|
||||
|
||||
it("should toggle like", () => {
|
||||
Api.post('foo', postLikeEntity).then(
|
||||
(response) => {
|
||||
|
|
Loading…
Reference in a new issue