1 |
|
2 |
|
3 | var helper = require('../lib/helper')
|
4 | , should = require('chai').should()
|
5 | ;
|
6 |
|
7 | describe('helper.shouldObjectifyMarkup()', function(){
|
8 | it('should succeed on text', function() {
|
9 | var input = ['Some words'];
|
10 | helper.shouldObjectifyMarkup(input).should.be.true;
|
11 | });
|
12 |
|
13 | it('should succeed when no duplicates', function() {
|
14 | var input = [
|
15 | [
|
16 | {$name: 'item', $text: 'something'},
|
17 | {$name: 'item', $text: 'else'}
|
18 | ],
|
19 | [
|
20 | {$name: 'other', $text: 'something'},
|
21 | {$name: 'other', $text: 'else'}
|
22 | ]
|
23 | ];
|
24 | helper.shouldObjectifyMarkup(input).should.be.true;
|
25 | input.push('some text');
|
26 | helper.shouldObjectifyMarkup(input).should.be.true;
|
27 | });
|
28 |
|
29 | it('should fail on duplicates', function() {
|
30 | var input = [
|
31 | [{$name: 'other', $text: 'something'}],
|
32 | [
|
33 | {$name: 'item', $text: 'something'},
|
34 | {$name: 'item', $text: 'else'}
|
35 | ],
|
36 | [{$name: 'other', $text: 'else'}]
|
37 | ];
|
38 | helper.shouldObjectifyMarkup(input).should.be.false;
|
39 | });
|
40 |
|
41 | it('should fail on duplicate text items', function() {
|
42 | var input = [
|
43 | 'text',
|
44 | [
|
45 | {$name: 'item', $text: 'something'},
|
46 | {$name: 'item', $text: 'else'}
|
47 | ],
|
48 | 'text'
|
49 | ];
|
50 | helper.shouldObjectifyMarkup(input).should.be.false;
|
51 | });
|
52 | });
|