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

test/core/Qualifier.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 Qualifier.js ➔ describe(ꞌQualifierꞌ) 0 41 1
1
var assert = require('chai').assert,
2
    GedcomX = require('../../');
3
4
describe('Qualifier', function(){
5
  
6
  it('Create plain', function(){
7
    var newRef = new GedcomX.Qualifier(),
8
        ref = GedcomX.Qualifier();
9
    assert.instanceOf(newRef, GedcomX.Qualifier, 'An instance of Qualifier is not returned when calling the constructor with new.');
10
    assert.instanceOf(ref, GedcomX.Qualifier, 'An instance of Qualifier is not returned when calling the constructor without new.');
11
  });
12
  
13
  it('Create with JSON', function(){
14
    var ref = GedcomX.Qualifier({
15
      name: 'http://gedcomx.org/Age',
16
      value: '37'
17
    });
18
    assert.equal(ref.getName(), 'http://gedcomx.org/Age');
19
    assert.equal(ref.getValue(), '37');
20
  });
21
  
22
  it('Build', function(){
23
    var ref = GedcomX.Qualifier()
24
      .setName('http://gedcomx.org/Age')
25
      .setValue('37');
26
    assert.equal(ref.getName(), 'http://gedcomx.org/Age');
27
    assert.equal(ref.getValue(), '37');
28
  });
29
  
30
  it('toJSON', function(){
31
    var data = {
32
      name: 'http://gedcomx.org/Age',
33
      value: '37'
34
    }, ref = GedcomX.Qualifier(data);
35
    assert.deepEqual(ref.toJSON(), data);
36
  });
37
  
38
  it('constructor does not copy instances', function(){
39
    var obj1 = GedcomX.Qualifier();
40
    var obj2 = GedcomX.Qualifier(obj1);
41
    assert.strictEqual(obj1, obj2);
42
  });
43
  
44
});