Skip to content

Commit 6f8aaf1

Browse files
author
Ferass El Hafidi
committed
spec/: fix tests to match previous changes
Signed-off-by: Ferass El Hafidi <[email protected]>
1 parent 5490f35 commit 6f8aaf1

File tree

2 files changed

+12
-16
lines changed

2 files changed

+12
-16
lines changed

spec/integ/matrix-to-irc.spec.js

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ describe("Matrix-to-IRC message bridging", function() {
298298
expect(client.nick).toEqual(testUser.nick);
299299
expect(client.addr).toEqual(roomMapping.server);
300300
expect(channel).toEqual(roomMapping.channel);
301-
expect(text).toEqual(`<${repliesUser.nick}> "This is the real message" <- Reply Text`);
301+
expect(text).toEqual(`${repliesUser.nick}: "This is the real message" <- Reply Text`);
302302
}
303303
);
304304
const formatted_body = constructHTMLReply(
@@ -389,7 +389,7 @@ describe("Matrix-to-IRC message bridging", function() {
389389
expect(client.nick).toEqual(testUser.nick);
390390
expect(client.addr).toEqual(roomMapping.server);
391391
expect(channel).toEqual(roomMapping.channel);
392-
expect(text).toEqual(`<${repliesUser.nick}> "This..." <- Reply Text`);
392+
expect(text).toEqual(`${repliesUser.nick}: "This..." <- Reply Text`);
393393
}
394394
);
395395
const formatted_body = constructHTMLReply(
@@ -499,7 +499,7 @@ describe("Matrix-to-IRC message bridging", function() {
499499
expect(client.nick).toEqual(testUser.nick);
500500
expect(client.addr).toEqual(roomMapping.server);
501501
expect(channel).toEqual(roomMapping.channel);
502-
expect(text).toEqual('<M-friend> "Message #2" <- Message #3');
502+
expect(text).toEqual('M-friend: "Message #2" <- Message #3');
503503
}
504504
);
505505

@@ -650,7 +650,7 @@ describe("Matrix-to-IRC message bridging", function() {
650650
});
651651
});
652652

653-
it("should bridge mutliline code blocks as IRC action with URL", function(done) {
653+
it("should bridge mutliline code blocks as a URL", function(done) {
654654
let tBody =
655655
"```javascript\n" +
656656
" expect(text.indexOf(\"javascript\")).not.toEqual(-1);\n" +
@@ -667,8 +667,7 @@ describe("Matrix-to-IRC message bridging", function() {
667667
expect(client.addr).toEqual(roomMapping.server);
668668
expect(channel).toEqual(roomMapping.channel);
669669
// don't be too brittle when checking this, but I expect to see the
670-
// code type and the mxc fragment.
671-
expect(text.indexOf('javascript')).not.toEqual(-1);
670+
// mxc fragment.
672671
expect(text.indexOf('deadbeefcafe')).not.toEqual(-1);
673672
done();
674673
});
@@ -713,7 +712,7 @@ describe("Matrix-to-IRC message bridging", function() {
713712
});
714713
});
715714

716-
it("should bridge matrix images as IRC action with a URL", function(done) {
715+
it("should bridge matrix images as a URL", function(done) {
717716
const tBody = "the_image.jpg";
718717
const tMxcSegment = "/somecontentid";
719718
const tHsUrl = "https://some.home.server.goeshere/";
@@ -723,8 +722,7 @@ describe("Matrix-to-IRC message bridging", function() {
723722
expect(client.addr).toEqual(roomMapping.server);
724723
expect(channel).toEqual(roomMapping.channel);
725724
// don't be too brittle when checking this, but I expect to see the
726-
// filename (body) and the http url.
727-
expect(text.indexOf(tBody)).not.toEqual(-1);
725+
// http url.
728726
expect(text.indexOf(tHsUrl)).not.toEqual(-1);
729727
expect(text.indexOf(tMxcSegment)).not.toEqual(-1);
730728
done();
@@ -742,7 +740,7 @@ describe("Matrix-to-IRC message bridging", function() {
742740
});
743741
});
744742

745-
it("should bridge matrix files as IRC action with a URL", function(done) {
743+
it("should bridge matrix files as a URL", function(done) {
746744
const tBody = "a_file.apk";
747745
const tMxcSegment = "/somecontentid";
748746
const tHsUrl = "https://some.home.server.goeshere/";
@@ -752,8 +750,7 @@ describe("Matrix-to-IRC message bridging", function() {
752750
expect(client.addr).toEqual(roomMapping.server);
753751
expect(channel).toEqual(roomMapping.channel);
754752
// don't be too brittle when checking this, but I expect to see the
755-
// filename (body) and the http url.
756-
expect(text.indexOf(tBody)).not.toEqual(-1);
753+
// http url.
757754
expect(text.indexOf(tHsUrl)).not.toEqual(-1);
758755
expect(text.indexOf(tMxcSegment)).not.toEqual(-1);
759756
done();
@@ -1097,8 +1094,7 @@ describe("Matrix-to-IRC message bridging with media URL and drop time", function
10971094
expect(client.addr).toEqual(roomMapping.server);
10981095
expect(channel).toEqual(roomMapping.channel);
10991096
// don't be too brittle when checking this, but I expect to see the
1100-
// filename (body) and the http url.
1101-
expect(text.indexOf(tBody)).not.toEqual(-1, "File name not present");
1097+
// http url.
11021098
expect(text.indexOf(tHsUrl)).toEqual(-1, "HS URL present instead of media URL");
11031099
expect(text.indexOf(tMediaUrl)).not.toEqual(-1, "No media URL");
11041100
expect(text.indexOf(tMxcSegment)).not.toEqual(-1, "No Mxc segment");

spec/unit/BridgedClient.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ describe("BridgedClient", function() {
3131
expect(BridgedClient.getValidNick("f+/\u3052oobar", false, STATE_DISC)).toBe("foobar");
3232
});
3333
it("will ensure nicks start with a letter or special character", function() {
34-
expect(BridgedClient.getValidNick("-foobar", false, STATE_DISC)).toBe("M-foobar");
35-
expect(BridgedClient.getValidNick("12345", false, STATE_DISC)).toBe("M12345");
34+
expect(BridgedClient.getValidNick("-foobar", false, STATE_DISC)).toBe("`-foobar");
35+
expect(BridgedClient.getValidNick("12345", false, STATE_DISC)).toBe("`12345");
3636
});
3737
it("will throw if the nick is invalid", function() {
3838
expect(() => BridgedClient.getValidNick("f+/\u3052oobar", true, STATE_DISC)).toThrowError();

0 commit comments

Comments
 (0)