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
|
|
|
}); |