test/atom/AtomCategory.js   A
last analyzed

Complexity

Total Complexity 6
Complexity/F 1

Size

Lines of Code 47
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 47
rs 10
wmc 6
mnd 0
bc 6
fnc 6
bpm 1
cpm 1
noi 0

1 Function

Rating   Name   Duplication   Size   Complexity  
B AtomCategory.js ➔ describe(ꞌAtomCategoryꞌ) 0 44 1
1
var assert = require('chai').assert,
2
    GedcomX = require('../../');
3
4
describe('AtomCategory', function(){
5
  
6
  it('Create plain', function(){
7
    assert.instanceOf(new GedcomX.AtomCategory(), GedcomX.AtomCategory, 'An instance of AtomCategory is not returned when calling the constructor with new.');
8
    assert.instanceOf(GedcomX.AtomCategory(), GedcomX.AtomCategory, 'An instance of AtomCategory is not returned when calling the constructor without new.');
9
  });
10
  
11
  it('Create with JSON', function(){
12
    var category = GedcomX.AtomCategory({
13
      scheme: 'scheme',
14
      term: 'term',
15
      label: 'label'
16
    });
17
    assert.equal(category.getScheme(), 'scheme');
18
    assert.equal(category.getTerm(), 'term');
19
    assert.equal(category.getLabel(), 'label');
20
  });
21
  
22
  it('Build', function(){
23
    var category = GedcomX.AtomCategory()
24
      .setScheme('scheme')
25
      .setTerm('term')
26
      .setLabel('label');
27
    assert.equal(category.getScheme(), 'scheme');
28
    assert.equal(category.getTerm(), 'term');
29
    assert.equal(category.getLabel(), 'label');
30
  });
31
  
32
  it('toJSON', function(){
33
    var data = {
34
      scheme: 'scheme',
35
      term: 'term',
36
      label: 'label'
37
    }, category = GedcomX.AtomCategory(data);
38
    assert.deepEqual(category.toJSON(), data);
39
  });
40
  
41
  it('constructor does not copy instances', function(){
42
    var obj1 = GedcomX.AtomCategory();
43
    var obj2 = GedcomX.AtomCategory(obj1);
44
    assert.strictEqual(obj1, obj2);
45
  });
46
  
47
});