From ef6f10c5a2c7636cb598c1027cfad4d179906918 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Wed, 28 Apr 2021 09:53:44 +0200 Subject: [PATCH] test for Path.replace --- src/domain/navigation/Navigation.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/domain/navigation/Navigation.js b/src/domain/navigation/Navigation.js index 9d059ec9..3167475f 100644 --- a/src/domain/navigation/Navigation.js +++ b/src/domain/navigation/Navigation.js @@ -245,6 +245,17 @@ export function tests() { const path = new Path([new Segment("foo", 5), new Segment("bar", 6)], () => true); assert.equal(path.get("foo").value, 5); 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); } }; }