Skip to content

Commit a6b7054

Browse files
committed
test(testmessagevalue): add test cases for testmessagevalue
1 parent 0f73b9c commit a6b7054

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

spec/message/TestMessageValue-spec.ts

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import { expect } from 'chai';
2+
import { Notification } from 'rxjs/Notification';
3+
import { SubscriptionLog } from 'rxjs/testing/SubscriptionLog';
4+
import { complete, error, next, subscribe, TestMessageValue } from '../../src/message/TestMessageValue';
5+
6+
describe('TestMessageValue', () => {
7+
it('should create metadata', () => {
8+
const notification = Notification.createNext('meh');
9+
10+
const message = new TestMessageValue(10, notification);
11+
12+
expect(message.frame).to.equal(10);
13+
expect(message.notification).to.deep.equal(notification);
14+
});
15+
16+
describe('utility function', () => {
17+
it('should create next', () => {
18+
const value = next(10, 'meh');
19+
20+
expect(value).to.deep.equal(new TestMessageValue(10, Notification.createNext('meh')));
21+
});
22+
23+
it('should create error', () => {
24+
const errorValue = error(10, 'meh');
25+
26+
expect(errorValue).to.deep.equal(new TestMessageValue(10, Notification.createError('meh')));
27+
});
28+
29+
it('should create complete', () => {
30+
const completeValue = complete(10);
31+
32+
expect(completeValue).to.deep.equal(new TestMessageValue(10, Notification.createComplete()));
33+
});
34+
35+
it('should create subscription log', () => {
36+
const withUnsub = subscribe(10, 20);
37+
const withoutSub = subscribe(10);
38+
39+
expect(withUnsub).to.deep.equal(new SubscriptionLog(10, 20));
40+
expect(withoutSub).to.deep.equal(new SubscriptionLog(10, Number.POSITIVE_INFINITY));
41+
});
42+
});
43+
});

0 commit comments

Comments
 (0)