minor code coverage

This commit is contained in:
Cadence Ember 2023-08-24 17:23:32 +12:00
parent c56e92ccfb
commit 1e9e9685c5
4 changed files with 16 additions and 2 deletions

View file

@ -39,6 +39,7 @@ function* generateLocalpartAlternatives(preferences) {
let i = 2
while (true) {
yield best + (i++)
/* c8 ignore next */
}
}
@ -69,7 +70,7 @@ function userToSimName(user) {
for (const suggestion of generateLocalpartAlternatives(preferences)) {
if (!matches.includes(suggestion)) return suggestion
}
/* c8 ignore next */
throw new Error(`Ran out of suggestions when generating sim name. downcased: "${downcased}"`)
}

View file

@ -32,7 +32,7 @@ function eventToMessage(event) {
})
} else if (event.content.msgtype === "m.emote") {
messages.push({
content: `*${displayName} ${event.content.body}*`,
content: `\* _${displayName} ${event.content.body}_`,
username: displayName,
avatar_url: avatarURL
})

12
matrix/txnid.test.js Normal file
View 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)
})

View file

@ -20,6 +20,7 @@ file._actuallyUploadDiscordFileToMxc = function(url, res) { throw new Error(`Not
require("../matrix/kstate.test")
require("../matrix/api.test")
require("../matrix/read-registration.test")
require("../matrix/txnid.test")
require("../d2m/converters/message-to-event.test")
require("../d2m/converters/message-to-event.embeds.test")
require("../d2m/converters/edit-to-changes.test")