Skip to content

Commit 5ef5edf

Browse files
committed
Test beforeAnnotationCreated identity.simple hook
1 parent 4fa8f36 commit 5ef5edf

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

test/spec/identity_spec.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,27 @@ describe('identity.simple', function () {
2222
sinon.assert.calledWithMatch(register, policy, 'identityPolicy');
2323
});
2424
});
25+
26+
describe('beforeAnnotationCreatedHook', function () {
27+
var sandbox;
28+
29+
beforeEach(function () {
30+
sandbox = sinon.sandbox.create();
31+
});
32+
33+
afterEach(function () {
34+
sandbox.restore();
35+
});
36+
37+
it('sets the user property of the annotation', function () {
38+
var policyProto = identity.SimpleIdentityPolicy.prototype;
39+
sandbox.stub(policyProto, 'who').returns('alice');
40+
41+
var annotation = {};
42+
ext.beforeAnnotationCreated(annotation);
43+
assert.equal(annotation.user, 'alice');
44+
});
45+
});
2546
});
2647

2748
describe('identity.SimpleIdentityPolicy', function () {

0 commit comments

Comments
 (0)