Completed
Pull Request — master (#13)
by Justin
07:02
created

test/SourceCitation.js   A

Complexity

Total Complexity 6
Complexity/F 1

Size

Lines of Code 42
Function Count 6

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

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

1 Function

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