Merge pull request #2175 from thelounge/astorije/fix-tests

Ignore order of preview results in unicode link tests
This commit is contained in:
Jérémie Astori 2018-03-08 21:22:29 -05:00 committed by GitHub
commit f3c10bdd42
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -310,18 +310,18 @@ describe("Link plugin", function() {
this.irc.on("msg:preview", function(data) {
previews.push(data.preview.link);
if (data.preview.link.indexOf("%C4%B1o%C4%B1-test") > 0) {
if (data.preview.link.includes("%C4%B1o%C4%B1-test")) {
expect(data.preview.head).to.equal("ıoı-test");
} else if (data.preview.link.indexOf("%D1%80%D1%83%D1%81%D1%81%D0%BA%D0%B8%D0%B9-%D1%82%D0%B5%D0%BA%D1%81%D1%82-test") > 0) {
} else if (data.preview.link.includes("%D1%80%D1%83%D1%81%D1%81%D0%BA%D0%B8%D0%B9-%D1%82%D0%B5%D0%BA%D1%81%D1%82-test")) {
expect(data.preview.head).to.equal("русский-текст-test");
} else if (data.preview.link.indexOf("%F0%9F%99%88-emoji-test") > 0) {
} else if (data.preview.link.includes("%F0%9F%99%88-emoji-test")) {
expect(data.preview.head).to.equal("🙈-emoji-test");
} else {
expect("This should never happen").to.equal(data.preview.link);
}
if (previews.length === 5) {
expect(message.previews.map((preview) => preview.link)).to.deep.equal(previews);
expect(message.previews.map((preview) => preview.link)).to.have.members(previews);
done();
}
});