mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 11:35:04 +01:00
test for Path.replace
This commit is contained in:
parent
1c5b953026
commit
ef6f10c5a2
@ -245,6 +245,17 @@ export function tests() {
|
|||||||
const path = new Path([new Segment("foo", 5), new Segment("bar", 6)], () => true);
|
const path = new Path([new Segment("foo", 5), new Segment("bar", 6)], () => true);
|
||||||
assert.equal(path.get("foo").value, 5);
|
assert.equal(path.get("foo").value, 5);
|
||||||
assert.equal(path.get("bar").value, 6);
|
assert.equal(path.get("bar").value, 6);
|
||||||
|
},
|
||||||
|
"path.replace success": assert => {
|
||||||
|
const path = new Path([new Segment("foo", 5), new Segment("bar", 6)], () => true);
|
||||||
|
const newPath = path.replace(new Segment("foo", 1));
|
||||||
|
assert.equal(newPath.get("foo").value, 1);
|
||||||
|
assert.equal(newPath.get("bar").value, 6);
|
||||||
|
},
|
||||||
|
"path.replace not found": assert => {
|
||||||
|
const path = new Path([new Segment("foo", 5), new Segment("bar", 6)], () => true);
|
||||||
|
const newPath = path.replace(new Segment("baz", 1));
|
||||||
|
assert.equal(newPath, null);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user