Skip to content

Commit 62cadb3

Browse files
xyzshantaramjeromeludmann
authored andcommitted
fix tests to account for new CAP order
1 parent 49cf5a5 commit 62cadb3

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

plugins/registration.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,18 +102,19 @@ export default createPlugin(
102102
if (!password) {
103103
sendRegistration();
104104
return client.utils.negotiateCapabilities({ completeImmediately: true });
105-
}
106-
else if (authMethod === "NickServ") {
105+
} else if (authMethod === "NickServ") {
107106
client.utils.negotiateCapabilities({ completeImmediately: true });
108107
sendRegistration();
109108
tryNickServ();
110109
} else {
111110
client.utils.negotiateCapabilities({ extraCaps: ["sasl"] });
112-
sendRegistration();
113111
trySasl();
114112
client.once(
115113
"raw:rpl_saslsuccess",
116-
() => client.utils.completeCapNegotiation(),
114+
() => {
115+
client.utils.completeCapNegotiation();
116+
sendRegistration();
117+
},
117118
);
118119
}
119120
});

plugins/registration_test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,10 @@ describe("plugins/registration", (test) => {
7070
await client.connect("");
7171
const raw = server.receive();
7272
assertEquals(raw, [
73-
"NICK me",
74-
"USER user 0 * :real name",
7573
"CAP REQ multi-prefix",
7674
"CAP END",
75+
"NICK me",
76+
"USER user 0 * :real name",
7777
"PRIVMSG NickServ :identify user password",
7878
]);
7979
});
@@ -90,11 +90,11 @@ describe("plugins/registration", (test) => {
9090
const raw = server.receive();
9191

9292
assertEquals(raw, [
93-
"NICK me",
94-
"USER user 0 * :real name",
9593
"CAP REQ multi-prefix",
9694
"CAP REQ sasl",
9795
"CAP END",
96+
"NICK me",
97+
"USER user 0 * :real name",
9898
]);
9999

100100
server.send(":serverhost CAP me ACK :sasl");

0 commit comments

Comments
 (0)