mirror of
https://github.com/discourse/discourse.git
synced 2024-11-26 14:13:38 +08:00
DEV: Remove duplicated tests (#28889)
This commit is contained in:
parent
4d484d89d0
commit
6bc9153a0d
|
@ -11,7 +11,7 @@ import {
|
|||
module("Discourse Chat | Unit | get-reaction-text", function (hooks) {
|
||||
setupTest(hooks);
|
||||
|
||||
test("no reaction ", function (assert) {
|
||||
test("no reaction", function (assert) {
|
||||
const reaction = new ChatFabricators(getOwner(this)).reaction({
|
||||
count: 0,
|
||||
users: [],
|
||||
|
@ -21,74 +21,6 @@ module("Discourse Chat | Unit | get-reaction-text", function (hooks) {
|
|||
assert.strictEqual(getReactionText(reaction, currentUser), undefined);
|
||||
});
|
||||
|
||||
test("current user reacted - one reaction", function (assert) {
|
||||
const currentUser = new CoreFabricators(getOwner(this)).user();
|
||||
|
||||
const reaction = new ChatFabricators(getOwner(this)).reaction({
|
||||
count: 1,
|
||||
users: [currentUser],
|
||||
reacted: true,
|
||||
});
|
||||
|
||||
assert.strictEqual(
|
||||
getReactionText(reaction, currentUser),
|
||||
"<span>You reacted with </span>:heart:"
|
||||
);
|
||||
});
|
||||
|
||||
test("current user reacted - two reactions", function (assert) {
|
||||
const currentUser = new CoreFabricators(getOwner(this)).user();
|
||||
const secondUser = new CoreFabricators(getOwner(this)).user({
|
||||
username: "martin",
|
||||
});
|
||||
const reaction = new ChatFabricators(getOwner(this)).reaction({
|
||||
count: 2,
|
||||
users: [currentUser, secondUser],
|
||||
reacted: true,
|
||||
});
|
||||
|
||||
assert.strictEqual(
|
||||
getReactionText(reaction, currentUser),
|
||||
"<span>You and martin reacted with </span>:heart:"
|
||||
);
|
||||
});
|
||||
|
||||
test("current user reacted - more than display limit reactions", function (assert) {
|
||||
const currentUser = new CoreFabricators(getOwner(this)).user();
|
||||
const otherUsers = Array.from(Array(MAX_DISPLAYED_USERNAMES + 1)).map(
|
||||
(_, i) =>
|
||||
new CoreFabricators(getOwner(this)).user({ username: "user" + i })
|
||||
);
|
||||
const reaction = new ChatFabricators(getOwner(this)).reaction({
|
||||
count: [currentUser].concat(otherUsers).length,
|
||||
users: [currentUser].concat(otherUsers),
|
||||
reacted: true,
|
||||
});
|
||||
|
||||
assert.strictEqual(
|
||||
getReactionText(reaction, currentUser),
|
||||
"<span>You, user0, user1, user2, user3, user4, user5, user6, user7, user8, user9, user10, user11, user12, user13, user14 and 1 other reacted with </span>:heart:"
|
||||
);
|
||||
});
|
||||
|
||||
test("current user reacted - less or equal than display limit reactions", function (assert) {
|
||||
const currentUser = new CoreFabricators(getOwner(this)).user();
|
||||
const otherUsers = Array.from(Array(MAX_DISPLAYED_USERNAMES - 2)).map(
|
||||
(_, i) =>
|
||||
new CoreFabricators(getOwner(this)).user({ username: "user" + i })
|
||||
);
|
||||
const reaction = new ChatFabricators(getOwner(this)).reaction({
|
||||
count: [currentUser].concat(otherUsers).length,
|
||||
users: [currentUser].concat(otherUsers),
|
||||
reacted: true,
|
||||
});
|
||||
|
||||
assert.strictEqual(
|
||||
getReactionText(reaction, currentUser),
|
||||
"<span>You, user0, user1, user2, user3, user4, user5, user6, user7, user8, user9, user10, user11 and user12 reacted with </span>:heart:"
|
||||
);
|
||||
});
|
||||
|
||||
test("current user reacted - one reaction", function (assert) {
|
||||
const currentUser = new CoreFabricators(getOwner(this)).user();
|
||||
const reaction = new ChatFabricators(getOwner(this)).reaction({
|
||||
|
|
Loading…
Reference in New Issue
Block a user