Copybara | 854996b | 2021-09-07 19:36:02 +0000 | [diff] [blame] | 1 | // Copyright 2019 The Chromium Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | import {assert} from 'chai'; |
| 6 | import {cueNameToSpec, specToCueName} from './cue-helpers.js'; |
| 7 | |
| 8 | |
| 9 | describe('cue-helpers', () => { |
| 10 | describe('cueNameToSpec', () => { |
| 11 | it('appends cue prefix', () => { |
| 12 | assert.equal(cueNameToSpec('test'), 'cue.test'); |
| 13 | }); |
| 14 | }); |
| 15 | |
| 16 | describe('specToCueName', () => { |
| 17 | it('extracts cue name from matching spec', () => { |
| 18 | assert.equal(specToCueName('cue.test'), 'test'); |
| 19 | assert.equal(specToCueName('cue.hello-world'), 'hello-world'); |
| 20 | assert.equal(specToCueName('cue.under_score'), 'under_score'); |
| 21 | }); |
| 22 | |
| 23 | it('does not extract cue name from non-matching spec', () => { |
| 24 | assert.equal(specToCueName('.cue.test'), ''); |
| 25 | assert.equal(specToCueName('hello-world-cue.'), ''); |
| 26 | assert.equal(specToCueName('cu.under_score'), ''); |
| 27 | assert.equal(specToCueName('field'), ''); |
| 28 | }); |
| 29 | }); |
| 30 | }); |