blob: c8d34bf81766c32a3993fe8fe3f644d978b8c37c [file] [log] [blame]
// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import {assert} from 'chai';
import {cueNameToSpec, specToCueName} from './cue-helpers.js';
describe('cue-helpers', () => {
describe('cueNameToSpec', () => {
it('appends cue prefix', () => {
assert.equal(cueNameToSpec('test'), 'cue.test');
});
});
describe('specToCueName', () => {
it('extracts cue name from matching spec', () => {
assert.equal(specToCueName('cue.test'), 'test');
assert.equal(specToCueName('cue.hello-world'), 'hello-world');
assert.equal(specToCueName('cue.under_score'), 'under_score');
});
it('does not extract cue name from non-matching spec', () => {
assert.equal(specToCueName('.cue.test'), '');
assert.equal(specToCueName('hello-world-cue.'), '');
assert.equal(specToCueName('cu.under_score'), '');
assert.equal(specToCueName('field'), '');
});
});
});