Add tests for label model
This commit is contained in:
parent
e7a1fa45b0
commit
9b07fba5eb
1 changed files with 26 additions and 0 deletions
|
@ -71,6 +71,32 @@ describe("model/label", () => {
|
|||
assert.equal(result, "labels");
|
||||
});
|
||||
|
||||
it("should like label", () => {
|
||||
const values = {ID: 5, LabelName: "Black Cat", LabelSlug: "black-cat", LabelFavorite: false};
|
||||
const label = new Label(values);
|
||||
assert.equal(label.LabelFavorite, false);
|
||||
label.like();
|
||||
assert.equal(label.LabelFavorite, true);
|
||||
});
|
||||
|
||||
it("should unlike label", () => {
|
||||
const values = {ID: 5, LabelName: "Black Cat", LabelSlug: "black-cat", LabelFavorite: true};
|
||||
const label = new Label(values);
|
||||
assert.equal(label.LabelFavorite, true);
|
||||
label.unlike();
|
||||
assert.equal(label.LabelFavorite, false);
|
||||
});
|
||||
|
||||
it("should toggle like", () => {
|
||||
const values = {ID: 5, LabelName: "Black Cat", LabelSlug: "black-cat", LabelFavorite: true};
|
||||
const label = new Label(values);
|
||||
assert.equal(label.LabelFavorite, true);
|
||||
label.toggleLike();
|
||||
assert.equal(label.LabelFavorite, false);
|
||||
label.toggleLike();
|
||||
assert.equal(label.LabelFavorite, true);
|
||||
});
|
||||
|
||||
it("should toggle like", () => {
|
||||
Api.post('foo', postLikeEntity).then(
|
||||
(response) => {
|
||||
|
|
Loading…
Reference in a new issue