1 | 'use strict';
|
2 |
|
3 | var expect = require('chai').expect;
|
4 | var SilentError = require('silent-error');
|
5 | var normalizeEntityName = require('./');
|
6 |
|
7 | describe('normalizeEntityName', function() {
|
8 | it('throws if no entity name is provides', function() {
|
9 | expect(function() {
|
10 | normalizeEntityName();
|
11 | }).to.throw(SilentError, 'SilentError: The `ember generate <entity-name>` command requires an entity name to be specified. For more details, use `ember help`.');
|
12 |
|
13 | expect(function() {
|
14 | normalizeEntityName('');
|
15 | }).to.throw(SilentError, 'SilentError: The `ember generate <entity-name>` command requires an entity name to be specified. For more details, use `ember help`.');
|
16 |
|
17 | expect(function() {
|
18 | normalizeEntityName(undefined);
|
19 | }).to.throw(SilentError, 'SilentError: The `ember generate <entity-name>` command requires an entity name to be specified. For more details, use `ember help`.');
|
20 |
|
21 | expect(function() {
|
22 | normalizeEntityName(null);
|
23 | }).to.throw(SilentError, 'SilentError: The `ember generate <entity-name>` command requires an entity name to be specified. For more details, use `ember help`.');
|
24 | });
|
25 |
|
26 | it('throws with trailing slash', function() {
|
27 | expect(function() {
|
28 | normalizeEntityName('asdf/');
|
29 | }).to.throw(SilentError, 'SilentError: You specified "asdf/", but you can\'t use a trailing slash as an entity name with generators. Please re-run the command with "asdf".');
|
30 | });
|
31 |
|
32 | it('acts like an identity function if the input was valid', function() {
|
33 | expect(normalizeEntityName('asdf')).to.eql('asdf');
|
34 | });
|
35 | });
|