blob: 3bc084a5697a84ced9d97069137a4c334de4e8b6 [file] [log] [blame]
Copybara854996b2021-09-07 19:36:02 +00001// 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
5import {assert} from 'chai';
6import {cueNameToSpec, specToCueName} from './cue-helpers.js';
7
8
9describe('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});