Repository navigation
Expand file tree
/
Copy pathOid.specs.js
More file actions
52 lines (49 loc) · 1.82 KB
/
Copy pathOid.specs.js
File metadata and controls
52 lines (49 loc) · 1.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import Sut, {InvalidOidToken} from './Oid';
describe('src/Oid', function() {
beforeEach(() => {
this.actual = undefined;
});
describe('given a valid Oid Token', () => {
beforeEach(() => {
this.oidToken = 'Member:20';
});
describe('when creating an Oid from the Oid Token', () => {
beforeEach(() => {
this.actual = new Sut(this.oidToken);
});
it('it should return an Oid with an asset type', () => {
this.actual.assetType.should.equal('Member');
});
it('it should return a read-only asset type property', () => {
(() => this.actual.assetType = 'Story').should.throw();
});
it('it should return an Oid with a ID number', () => {
this.actual.number.should.equal(20);
});
it('it should return a read-only ID number property', () => {
(() => this.actual.number = 25).should.throw();
});
});
describe('when toString is called', () => {
beforeEach(() => {
this.actual = new Sut(this.oidToken).toString();
});
it('it should return an Oid Token for the Oid', () => {
this.actual.should.equal('Member:20');
});
});
});
describe('given an invalid Oid Token', () => {
beforeEach(() => {
this.oidToken = 'Member:Username';
});
describe('when creating an Oid from the Oid token', () => {
beforeEach(() => {
this.fn = () => this.actual = new Sut(this.oidToken);
});
it('it should throw an InvalidOidToken error', () => {
this.fn.should.throw(InvalidOidToken);
});
});
});
});