github.com/anth0d/nomad@v0.0.0-20221214183521-ae3a0a2cad06/ui/tests/unit/helpers/format-volume-name-test.js (about) 1 import { module, test } from 'qunit'; 2 import { formatVolumeName } from 'nomad-ui/helpers/format-volume-name'; 3 4 module('Unit | Helper | formatVolumeName', function () { 5 test('Returns source as string when isPerAlloc is false', function (assert) { 6 const expectation = 'my-volume-source'; 7 assert.equal( 8 formatVolumeName(null, { 9 source: 'my-volume-source', 10 isPerAlloc: false, 11 volumeExtension: '[arbitrary]', 12 }), 13 expectation, 14 'false perAlloc' 15 ); 16 assert.equal( 17 formatVolumeName(null, { 18 source: 'my-volume-source', 19 isPerAlloc: null, 20 volumeExtension: '[arbitrary]', 21 }), 22 expectation, 23 'null perAlloc' 24 ); 25 }); 26 27 test('Returns concatonated name when isPerAlloc is true', function (assert) { 28 const expectation = 'my-volume-source[1]'; 29 assert.equal( 30 formatVolumeName(null, { 31 source: 'my-volume-source', 32 isPerAlloc: true, 33 volumeExtension: '[1]', 34 }), 35 expectation, 36 expectation 37 ); 38 }); 39 });