minor code coverage
This commit is contained in:
parent
c56e92ccfb
commit
1e9e9685c5
4 changed files with 16 additions and 2 deletions
|
@ -39,6 +39,7 @@ function* generateLocalpartAlternatives(preferences) {
|
||||||
let i = 2
|
let i = 2
|
||||||
while (true) {
|
while (true) {
|
||||||
yield best + (i++)
|
yield best + (i++)
|
||||||
|
/* c8 ignore next */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,7 +70,7 @@ function userToSimName(user) {
|
||||||
for (const suggestion of generateLocalpartAlternatives(preferences)) {
|
for (const suggestion of generateLocalpartAlternatives(preferences)) {
|
||||||
if (!matches.includes(suggestion)) return suggestion
|
if (!matches.includes(suggestion)) return suggestion
|
||||||
}
|
}
|
||||||
|
/* c8 ignore next */
|
||||||
throw new Error(`Ran out of suggestions when generating sim name. downcased: "${downcased}"`)
|
throw new Error(`Ran out of suggestions when generating sim name. downcased: "${downcased}"`)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@ function eventToMessage(event) {
|
||||||
})
|
})
|
||||||
} else if (event.content.msgtype === "m.emote") {
|
} else if (event.content.msgtype === "m.emote") {
|
||||||
messages.push({
|
messages.push({
|
||||||
content: `*${displayName} ${event.content.body}*`,
|
content: `\* _${displayName} ${event.content.body}_`,
|
||||||
username: displayName,
|
username: displayName,
|
||||||
avatar_url: avatarURL
|
avatar_url: avatarURL
|
||||||
})
|
})
|
||||||
|
|
12
matrix/txnid.test.js
Normal file
12
matrix/txnid.test.js
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
// @ts-check
|
||||||
|
|
||||||
|
const {test} = require("supertape")
|
||||||
|
const txnid = require("./txnid")
|
||||||
|
|
||||||
|
test("txnid: generates different values each run", t => {
|
||||||
|
const one = txnid.makeTxnId()
|
||||||
|
t.ok(one)
|
||||||
|
const two = txnid.makeTxnId()
|
||||||
|
t.ok(two)
|
||||||
|
t.notEqual(two, one)
|
||||||
|
})
|
|
@ -20,6 +20,7 @@ file._actuallyUploadDiscordFileToMxc = function(url, res) { throw new Error(`Not
|
||||||
require("../matrix/kstate.test")
|
require("../matrix/kstate.test")
|
||||||
require("../matrix/api.test")
|
require("../matrix/api.test")
|
||||||
require("../matrix/read-registration.test")
|
require("../matrix/read-registration.test")
|
||||||
|
require("../matrix/txnid.test")
|
||||||
require("../d2m/converters/message-to-event.test")
|
require("../d2m/converters/message-to-event.test")
|
||||||
require("../d2m/converters/message-to-event.embeds.test")
|
require("../d2m/converters/message-to-event.embeds.test")
|
||||||
require("../d2m/converters/edit-to-changes.test")
|
require("../d2m/converters/edit-to-changes.test")
|
||||||
|
|
Loading…
Reference in a new issue