github.com/sl1pm4t/consul@v1.4.5-0.20190325224627-74c31c540f9c/ui-v2/tests/unit/utils/ascend-test.js (about) 1 import { module } from 'ember-qunit'; 2 import test from 'ember-sinon-qunit/test-support/test'; 3 import ascend from 'consul-ui/utils/ascend'; 4 module('Unit | Utils | ascend', {}); 5 6 test('it returns a parent path (ascension of 1)', function(assert) { 7 const expected = '/quite/a/deep/path/for/'; 8 const actual = ascend(expected + 'parent', 1); 9 assert.equal(actual, expected); 10 }); 11 test('it returns a grand parent path (ascension of 2)', function(assert) { 12 const expected = 'quite/a/deep/path/for/'; 13 const actual = ascend(expected + 'grand/parent', 2); 14 assert.equal(actual, expected); 15 }); 16 test('ascending past root returns ""', function(assert) { 17 const expected = ''; 18 const actual = ascend('/short', 2); 19 assert.equal(actual, expected); 20 });