From 536eda42dfbb6d7ad5bef43c5ed1e53637d93c80 Mon Sep 17 00:00:00 2001 From: Josh Goebel Date: Thu, 24 Dec 2020 11:56:45 -0500 Subject: [PATCH] improve zipper tests (#839) * improve zipper tests Co-authored-by: Derk-Jan Karrenbeld --- exercises/zipper/zipper.spec.js | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/exercises/zipper/zipper.spec.js b/exercises/zipper/zipper.spec.js index d3957e5431..6b8e773b9a 100644 --- a/exercises/zipper/zipper.spec.js +++ b/exercises/zipper/zipper.spec.js @@ -1,7 +1,5 @@ import { Zipper } from './zipper'; -// Tests adapted from `problem-specifications/zipper/canonical-data.json` @ v1.0.0 - function bt(value, left, right) { return { value, @@ -74,4 +72,34 @@ describe('Zipper', () => { xtest('setValue on deep focus', () => { expect(zipper.left().right().setValue(5).toTree()).toEqual(t6); }); + + xtest('left returns a new Zipper', () => { + const left = zipper.left(); + expect(left).not.toBe(zipper); + }); + + xtest('right returns a new Zipper', () => { + const right = zipper.right(); + expect(right).not.toBe(zipper); + }); + + xtest('setValue returns a new Zipper', () => { + const anotherZipper = zipper.setValue(99); + expect(anotherZipper).not.toBe(zipper); + }); + + xtest('setRight returns a new Zipper', () => { + const right = zipper.setRight(bt(55, null, null)); + expect(right).not.toBe(zipper); + }); + + xtest('setLeft returns a new Zipper', () => { + const left = zipper.setLeft(bt(55, null, null)); + expect(left).not.toBe(zipper); + }); + + xtest('up returns a new Zipper', () => { + const up = zipper.right().up(); + expect(zipper).not.toBe(up); + }); });