diff --git a/test/javascripts/lib/link-mentions-test.js.es6 b/test/javascripts/lib/link-mentions-test.js.es6 new file mode 100644 index 00000000000..ae5a83c5cff --- /dev/null +++ b/test/javascripts/lib/link-mentions-test.js.es6 @@ -0,0 +1,61 @@ +import { + fetchUnseenMentions, + linkSeenMentions +} from "discourse/lib/link-mentions"; +import { Promise } from "rsvp"; + +QUnit.module("lib:link-mentions"); + +QUnit.test("linkSeenMentions replaces users and groups", async assert => { + /* global server */ + server.get("/u/is_local_username", () => [ + 200, + { "Content-Type": "application/json" }, + { + valid: ["valid_user"], + valid_groups: ["valid_group"], + mentionable_groups: [ + { + name: "mentionable_group", + user_count: 1 + } + ], + cannot_see: [], + max_users_notified_per_group_mention: 100 + } + ]); + + await fetchUnseenMentions([ + "valid_user", + "mentionable_group", + "valid_group", + "invalid" + ]); + + let $root = $(` +