discourse/test/javascripts/unit/models/user-action-test.js
Robin Ward 445d6ba45f REFACTOR: Move qunit tests to a different directory structure
This structure is closer to how ember-cli expects tests to be placed. It
is not their final position, just the first step towards it.
2020-09-30 10:36:49 -04:00

31 lines
759 B
JavaScript

import UserAction from "discourse/models/user-action";
QUnit.module("model: user-action");
QUnit.test("collapsing likes", (assert) => {
var actions = UserAction.collapseStream([
UserAction.create({
action_type: UserAction.TYPES.likes_given,
topic_id: 1,
user_id: 1,
post_number: 1,
}),
UserAction.create({
action_type: UserAction.TYPES.edits,
topic_id: 2,
user_id: 1,
post_number: 1,
}),
UserAction.create({
action_type: UserAction.TYPES.likes_given,
topic_id: 1,
user_id: 2,
post_number: 1,
}),
]);
assert.equal(actions.length, 2);
assert.equal(actions[0].get("children.length"), 1);
assert.equal(actions[0].get("children")[0].items.length, 2);
});