github.com/hernad/nomad@v1.6.112/ui/tests/integration/helpers/trim-path-test.js (about)

     1  /**
     2   * Copyright (c) HashiCorp, Inc.
     3   * SPDX-License-Identifier: MPL-2.0
     4   */
     5  
     6  import { module, test } from 'qunit';
     7  import { setupRenderingTest } from 'ember-qunit';
     8  import { render } from '@ember/test-helpers';
     9  import { hbs } from 'ember-cli-htmlbars';
    10  
    11  module('Integration | Helper | trim-path', function (hooks) {
    12    setupRenderingTest(hooks);
    13  
    14    test('it doesnt mess with internal slashes', async function (assert) {
    15      this.set('inputValue', 'a/b/c/d');
    16      await render(hbs`{{trim-path this.inputValue}}`);
    17      assert.dom(this.element).hasText('a/b/c/d');
    18    });
    19    test('it will remove a prefix slash', async function (assert) {
    20      this.set('inputValue', '/a/b/c/d');
    21      await render(hbs`{{trim-path this.inputValue}}`);
    22      assert.dom(this.element).hasText('a/b/c/d');
    23    });
    24    test('it will remove a suffix slash', async function (assert) {
    25      this.set('inputValue', 'a/b/c/d/');
    26      await render(hbs`{{trim-path this.inputValue}}`);
    27      assert.dom(this.element).hasText('a/b/c/d');
    28    });
    29    test('it will remove both at once', async function (assert) {
    30      this.set('inputValue', '/a/b/c/d/');
    31      await render(hbs`{{trim-path this.inputValue}}`);
    32      assert.dom(this.element).hasText('a/b/c/d');
    33    });
    34  });