github.com/sl1pm4t/consul@v1.4.5-0.20190325224627-74c31c540f9c/ui-v2/tests/unit/utils/right-trim-test.js (about) 1 import { module } from 'ember-qunit'; 2 import test from 'ember-sinon-qunit/test-support/test'; 3 import rightTrim from 'consul-ui/utils/right-trim'; 4 module('Unit | Utility | right trim'); 5 6 test('it trims characters from the right hand side', function(assert) { 7 [ 8 { 9 args: ['/a/folder/here/', '/'], 10 expected: '/a/folder/here', 11 }, 12 { 13 args: ['/a/folder/here', ''], 14 expected: '/a/folder/here', 15 }, 16 { 17 args: ['a/folder/here', '/'], 18 expected: 'a/folder/here', 19 }, 20 { 21 args: ['a/folder/here/', '/'], 22 expected: 'a/folder/here', 23 }, 24 { 25 args: [], 26 expected: '', 27 }, 28 { 29 args: ['/a/folder/here', '/folder/here'], 30 expected: '/a', 31 }, 32 { 33 args: ['/a/folder/here', 'a/folder/here'], 34 expected: '/', 35 }, 36 { 37 args: ['/a/folder/here/', '/a/folder/here/'], 38 expected: '', 39 }, 40 ].forEach(function(item) { 41 const actual = rightTrim(...item.args); 42 assert.equal(actual, item.expected); 43 }); 44 });