Skip to content

Commit

Permalink
adding tests
Browse files Browse the repository at this point in the history
  • Loading branch information
vitaly-t committed Jul 31, 2019
1 parent 63a24e0 commit 327addc
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions test/sub.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import {expect, chai} from './';
import {SubEvent} from '../src';

describe('Subscription', () => {
it('must maintain the live status correctly', () => {
const a = new SubEvent();
const sub = a.subscribe(() => {
});
expect(sub.live).to.be.true;
sub.cancel();
expect(sub.live).to.be.false;
});
it('must do nothing on repeated cancel', () => {
const a = new SubEvent();
const sub = a.subscribe(() => {
});
const res1 = sub.cancel();
const res2 = sub.cancel();
expect(res1).to.be.true;
expect(res2).to.be.false;
});
});

0 comments on commit 327addc

Please sign in to comment.