From 39edcca65939413b6a22ef13ca51d4fe72f41f65 Mon Sep 17 00:00:00 2001 From: David Ward Date: Mon, 8 May 2023 17:33:25 -0700 Subject: [PATCH] Add basic unit tests for ints, phase 2 --- test/specs/unit/util.unit.js | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/test/specs/unit/util.unit.js b/test/specs/unit/util.unit.js index bdfd511..68a4903 100755 --- a/test/specs/unit/util.unit.js +++ b/test/specs/unit/util.unit.js @@ -3,6 +3,28 @@ const { expect } = require('chai'); const util = require('../../../lib/util'); describe('util.js', () => { - context('isSortedHiToLow()', () => {}); - context('isSortedLowToHi()', () => {}); + context('isSortedHiToLow()', () => { + it('returns false when list is ascending', () => { + const list = [123, 456]; + const result = util.isSortedHiToLow(list); + expect(result).to.equal(false); + }); + it('returns true when list is descending', () => { + const list = [456, 123]; + const result = util.isSortedHiToLow(list); + expect(result).to.equal(true); + }); + }); + context('isSortedLowToHi()', () => { + it('returns true when list is ascending', () => { + const list = [123, 456]; + const result = util.isSortedLowToHi(list); + expect(result).to.equal(true); + }); + it('returns false when list is descending', () => { + const list = [456, 123]; + const result = util.isSortedLowToHi(list); + expect(result).to.equal(false); + }); + }); });