Completed
Push — master ( e3ee1d...5cbb1b )
by Justin
01:36
created

test/core/TextValue.js   A

Complexity

Total Complexity 6
Complexity/F 1

Size

Lines of Code 44
Function Count 6

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 0
c 1
b 0
f 0
nc 1
dl 0
loc 44
rs 10
wmc 6
mnd 0
bc 6
fnc 6
bpm 1
cpm 1
noi 0

1 Function

Rating   Name   Duplication   Size   Complexity  
B TextValue.js ➔ describe(ꞌTextValueꞌ) 0 41 1
1
var assert = require('chai').assert,
2
    GedcomX = require('../../');
3
4
describe('TextValue', function(){
5
  
6
  it('Create plain', function(){
7
    var newValue = new GedcomX.TextValue(),
8
        value = GedcomX.TextValue();
9
    assert.instanceOf(newValue, GedcomX.TextValue, 'An instance of TextValue is not returned when calling the constructor with new.');
10
    assert.instanceOf(value, GedcomX.TextValue, 'An instance of TextValue is not returned when calling the constructor without new.');
11
  });
12
  
13
  it('Create with JSON', function(){
14
    var value = GedcomX.TextValue({
15
      lang: 'en',
16
      value: 'a full text value'
17
    });
18
    assert.equal(value.getLang(), 'en');
19
    assert.equal(value.getValue(), 'a full text value');
20
  });
21
  
22
  it('Build', function(){
23
    var value = GedcomX.TextValue()
24
      .setLang('en')
25
      .setValue('a full text value');
26
    assert.equal(value.getLang(), 'en');
27
    assert.equal(value.getValue(), 'a full text value');
28
  });
29
  
30
  it('toJSON', function(){
31
    var data = {
32
      lang: 'en',
33
      value: 'a full text value'
34
    }, value = GedcomX.TextValue(data);
35
    assert.deepEqual(value.toJSON(), data);
36
  });
37
  
38
  it('constructor does not copy instances', function(){
39
    var obj1 = GedcomX.TextValue();
40
    var obj2 = GedcomX.TextValue(obj1);
41
    assert.strictEqual(obj1, obj2);
42
  });
43
  
44
});