github.com/sl1pm4t/consul@v1.4.5-0.20190325224627-74c31c540f9c/ui-v2/tests/unit/utils/keyToArray-test.js (about) 1 import { module } from 'ember-qunit'; 2 import test from 'ember-sinon-qunit/test-support/test'; 3 import keyToArray from 'consul-ui/utils/keyToArray'; 4 module('Unit | Utils | keyToArray', {}); 5 6 test('it splits a string by a separator, unless the string is the separator', function(assert) { 7 [ 8 { 9 test: '/', 10 expected: [''], 11 }, 12 { 13 test: 'hello/world', 14 expected: ['hello', 'world'], 15 }, 16 { 17 test: '/hello/world', 18 expected: ['', 'hello', 'world'], 19 }, 20 { 21 test: '//', 22 expected: ['', '', ''], 23 }, 24 ].forEach(function(item) { 25 const actual = keyToArray(item.test); 26 assert.deepEqual(actual, item.expected); 27 }); 28 });