mirror of
https://gitdab.com/cadence/out-of-your-element.git
synced 2025-09-09 11:53:04 +02:00
Rearrange code (self-review)
This commit is contained in:
parent
c5d6c5e4c7
commit
47ac49a855
16 changed files with 275 additions and 74 deletions
|
@ -1,3 +1,4 @@
|
|||
const assert = require("assert")
|
||||
const {kstateToState, stateToKState, diffKState, kstateStripConditionals} = require("./kstate")
|
||||
const {test} = require("supertape")
|
||||
|
||||
|
@ -162,3 +163,29 @@ test("diffKState: power levels are mixed together", t => {
|
|||
})
|
||||
t.notDeepEqual(original, result)
|
||||
})
|
||||
|
||||
test("diffKState: cannot merge power levels if original power levels are missing", t => {
|
||||
const original = {}
|
||||
assert.throws(() =>
|
||||
diffKState(original, {
|
||||
"m.room.power_levels/": {
|
||||
"events": {
|
||||
"m.room.avatar": 0
|
||||
}
|
||||
}
|
||||
})
|
||||
, /original power level data is missing/)
|
||||
t.pass()
|
||||
})
|
||||
|
||||
test("diffKState: kstate keys must contain a slash separator", t => {
|
||||
assert.throws(() =>
|
||||
diffKState({
|
||||
"m.room.name/": {name: "test name"},
|
||||
}, {
|
||||
"m.room.name/": {name: "test name"},
|
||||
"new": {a: 2}
|
||||
})
|
||||
, /does not contain a slash separator/)
|
||||
t.pass()
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue