1 | "use strict";
|
2 |
|
3 | var Names = require("../lib/boilerplate.view.parser.names")(function() {});
|
4 |
|
5 |
|
6 | describe('Module `boilerplate.view.parser.names`', function() {
|
7 | describe('function addName', function() {
|
8 | var names = new Names();
|
9 | it('("foo") should return true the first time', function() {
|
10 | expect( names.addName( "foo" ) ).toBe( true );
|
11 | });
|
12 | it('("foo") should return false the second time', function() {
|
13 | expect( names.addName( "foo" ) ).toBe( false );
|
14 | });
|
15 | it('("foo") should return false the third time', function() {
|
16 | expect( names.addName( "foo" ) ).toBe( false );
|
17 | });
|
18 | it('("bar") should return true the first time', function() {
|
19 | expect( names.addName( "bar" ) ).toBe( true );
|
20 | });
|
21 | it('("bar") should return false the second time', function() {
|
22 | expect( names.addName( "bar" ) ).toBe( false );
|
23 | });
|
24 | it('("bar") should return false the third time', function() {
|
25 | expect( names.addName( "bar" ) ).toBe( false );
|
26 | });
|
27 | });
|
28 |
|
29 | describe('function getFreeName', function() {
|
30 | var names = new Names();
|
31 | it('("foo") should return "foo1"', function() {
|
32 | expect( names.getFreeName("foo") ).toBe("foo1");
|
33 | });
|
34 | it('("bar") should return "bar1"', function() {
|
35 | expect( names.getFreeName("bar") ).toBe("bar1");
|
36 | });
|
37 | it('("foo") should return "foo2"', function() {
|
38 | expect( names.getFreeName("foo") ).toBe("foo2");
|
39 | });
|
40 | it('("foo") should return "foo3"', function() {
|
41 | expect( names.getFreeName("foo") ).toBe("foo3");
|
42 | });
|
43 | it('("bar") should return "bar2"', function() {
|
44 | expect( names.getFreeName("bar") ).toBe("bar2");
|
45 | });
|
46 | });
|
47 | });
|