test/rs/ResourceReference.js   A
last analyzed

Complexity

Total Complexity 4
Complexity/F 1

Size

Lines of Code 31
Function Count 4

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 31
rs 10
wmc 4
mnd 0
bc 4
fnc 4
bpm 1
cpm 1
noi 0

1 Function

Rating   Name   Duplication   Size   Complexity  
B ResourceReference.js ➔ describe(ꞌResourceReferenceꞌ) 0 28 1
1
var assert = require('chai').assert,
2
    GedcomX = require('../../');
3
4
describe('ResourceReference', function(){
5
  
6
  it('Create with JSON', function(){
7
    var rr = GedcomX.ResourceReference({ 
8
      resource: 'http://example.com',
9
      resourceId: 'rid'
10
    });
11
    assert.equal(rr.getResource(), 'http://example.com', 'Resource not saved properly when created with JSON');
12
    assert.equal(rr.getResourceId(), 'rid');
13
  });
14
  
15
  it('Build', function(){
16
    var rr = GedcomX.ResourceReference()
17
      .setResource('http://example.com')
18
      .setResourceId('rid');
19
    assert.equal(rr.getResource(), 'http://example.com', 'Resource not saved properly when created with JSON');
20
    assert.equal(rr.getResourceId(), 'rid');
21
  });
22
  
23
  it('toJSON()', function(){
24
    var data = { 
25
      resource: 'http://example.com',
26
      resourceId: 'rid'
27
    }, rr = GedcomX.ResourceReference(data);
28
    assert.deepEqual(rr.toJSON(), data);
29
  });
30
  
31
});