You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
consul/ui-v2/tests/unit/utils/ascend-test.js

22 lines
785 B

import { module } from 'qunit';
import test from 'ember-sinon-qunit/test-support/test';
import ascend from 'consul-ui/utils/ascend';
module('Unit | Utils | ascend', function() {
test('it returns a parent path (ascension of 1)', function(assert) {
const expected = '/quite/a/deep/path/for/';
const actual = ascend(expected + 'parent', 1);
assert.equal(actual, expected);
});
test('it returns a grand parent path (ascension of 2)', function(assert) {
const expected = 'quite/a/deep/path/for/';
const actual = ascend(expected + 'grand/parent', 2);
assert.equal(actual, expected);
});
test('ascending past root returns ""', function(assert) {
const expected = '';
const actual = ascend('/short', 2);
assert.equal(actual, expected);
});
});