WIP: feature: threads'n'forums #74
1 changed files with 5 additions and 20 deletions
|
|
@ -417,6 +417,11 @@ test("set user power: privileged users must demote themselves", async t => {
|
||||||
t.equal(called, 3)
|
t.equal(called, 3)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
test("getThreadRoomFromThreadEvent: real message with a thread", t => {
|
||||||
|
const room = getThreadRoomFromThreadEvent("$fdD9o7NxMA4VPexlAiIx2CB9JbsiGhJeyJgnZG7U5xg")
|
||||||
|
t.equal(room, "!FuDZhlOAtqswlyxzeR:cadence.moe")
|
||||||
|
})
|
||||||
|
|
||||||
test("getThreadRoomFromThreadEvent: real message, but without a thread", t => {
|
test("getThreadRoomFromThreadEvent: real message, but without a thread", t => {
|
||||||
const room = getThreadRoomFromThreadEvent("$Ij3qo7NxMA4VPexlAiIx2CB9JbsiGhJeyt-2OvkAUe4")
|
const room = getThreadRoomFromThreadEvent("$Ij3qo7NxMA4VPexlAiIx2CB9JbsiGhJeyt-2OvkAUe4")
|
||||||
const msg = "Expected null/undefined, got: "+room
|
const msg = "Expected null/undefined, got: "+room
|
||||||
|
|
@ -424,11 +429,6 @@ test("getThreadRoomFromThreadEvent: real message, but without a thread", t => {
|
||||||
else t.pass(msg)
|
else t.pass(msg)
|
||||||
})
|
})
|
||||||
|
|
||||||
test("getThreadRoomFromThreadEvent: real message with a thread", t => {
|
|
||||||
const room = getThreadRoomFromThreadEvent("$fdD9o7NxMA4VPexlAiIx2CB9JbsiGhJeyJgnZG7U5xg")
|
|
||||||
t.equal(room, "!FuDZhlOAtqswlyxzeR:cadence.moe")
|
|
||||||
})
|
|
||||||
|
|
||||||
test("getThreadRoomFromThreadEvent: fake message", t => {
|
test("getThreadRoomFromThreadEvent: fake message", t => {
|
||||||
const room = getThreadRoomFromThreadEvent("$ThisEvent-IdDoesNotExistInTheDatabase4Sure")
|
const room = getThreadRoomFromThreadEvent("$ThisEvent-IdDoesNotExistInTheDatabase4Sure")
|
||||||
const msg = "Expected null/undefined, got: "+room
|
const msg = "Expected null/undefined, got: "+room
|
||||||
|
|
@ -436,19 +436,4 @@ test("getThreadRoomFromThreadEvent: fake message", t => {
|
||||||
else t.pass(msg)
|
else t.pass(msg)
|
||||||
})
|
})
|
||||||
|
|
||||||
test("getThreadRoomFromThreadEvent: null", t => {
|
|
||||||
const room = getThreadRoomFromThreadEvent(null)
|
|
||||||
t.equal(room, null)
|
|
||||||
})
|
|
||||||
|
|
||||||
test("getThreadRoomFromThreadEvent: undefined", t => {
|
|
||||||
const room = getThreadRoomFromThreadEvent(undefined)
|
|
||||||
t.equal(room, undefined)
|
|
||||||
})
|
|
||||||
|
|
||||||
test("getThreadRoomFromThreadEvent: no value at all", t => {
|
|
||||||
const room = getThreadRoomFromThreadEvent() //This line should be giving a type-error, so it's not @ts-ignored on purpose. This is to test the desired behavior of that function, ie. „it CAN TAKE an undefined VALUE (as tested above), but you can just LEAVE the value completely undefined” (well, you can leave it like that from JS syntax perspective (which is why this test passes), but it makes no sense from usage standpoint, as it just gives back undefined). So this isn't a logic test (that's handled above), as much as it is a TypeScript test.
|
|
||||||
t.equal(room, undefined)
|
|
||||||
})
|
|
||||||
|
|
||||||
module.exports.mockGetEffectivePower = mockGetEffectivePower
|
module.exports.mockGetEffectivePower = mockGetEffectivePower
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue