Skip to content

Commit 18d3ef3

Browse files
committed
Unit tests to verify Profile.formatPrice uses "cmdtyView" formatter, by default
1 parent 592f04d commit 18d3ef3

File tree

2 files changed

+39
-3
lines changed

2 files changed

+39
-3
lines changed

test/specs/marketState/ProfileSpec.js

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,40 @@ describe('When a Profile is created (for a symbol with unitCode "2")', () => {
1212
it('formats 123.5 (with unit code 2) as "123-4"', () => {
1313
expect(p.formatPrice(123.5)).toEqual('123-4');
1414
});
15+
});
16+
17+
describe('When a Profile is created (an option on a ZB future")', () => {
18+
'use strict';
19+
20+
var p;
21+
22+
beforeEach(() => {
23+
p = new Profile('ZBM2|1500C', '30-Year T-Bond', 'CBOT', '5', 1000, 1);
24+
});
25+
26+
it('formats 0.5 as 0-32 (using sixty-fourths)', () => {
27+
expect(p.formatPrice(0.5)).toEqual('0-32');
28+
});
29+
30+
it('formats 0.984375 as 0-63 (using sixty-fourths)', () => {
31+
expect(p.formatPrice(0.984375)).toEqual('0-63');
32+
});
33+
});
34+
35+
describe('When a Profile is created (an option on a ZT future")', () => {
36+
'use strict';
37+
38+
var p;
39+
40+
beforeEach(() => {
41+
p = new Profile('ZTM2|1060C', '2-Year T-Note', 'CBOT', '6', 2000, 1);
42+
});
43+
44+
it('formats 0.5 as 0-320 (using sixty-fourths)', () => {
45+
expect(p.formatPrice(0.5)).toEqual('0-320');
46+
});
47+
48+
it('formats 0.9921875 as 0-635 (using sixty-fourths)', () => {
49+
expect(p.formatPrice(0.9921875)).toEqual('0-635');
50+
});
1551
});

test/specs/utilities/format/specialized/cmdtyViewSpec.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ const cmdtyView = require('./../../../../../lib/utilities/format/specialized/cmd
22
const Profile = require('./../../../../../lib/marketState/Profile');
33

44
const ZBM2_1500C = new Profile('ZBM2|1500C', '30-Year T-Bond', 'CBOT', '5', 1000, 1);
5-
const ZNM2_1230C = new Profile('ZNM2|1230C', '10-Year T-Note', 'CBOT', '5', 1000, 1);
5+
const ZNM2_1230C = new Profile('ZNM2|1230C', '10-Year T-Note', 'CBOT', '5', 1000, 1);
66

7-
const ZTM2_1060C = new Profile('ZTM2|1060C', '2-Year T-Note', 'CBOT', '6', 2000, 1);
8-
const ZFM2_1147C = new Profile('ZFM2|1147C', '5-Year T-Note', 'CBOT', '6', 1000, 1);
7+
const ZTM2_1060C = new Profile('ZTM2|1060C', '2-Year T-Note', 'CBOT', '6', 2000, 1);
8+
const ZFM2_1147C = new Profile('ZFM2|1147C', '5-Year T-Note', 'CBOT', '6', 1000, 1);
99

1010
describe('when formatting prices for a ZB options', () => {
1111
it('formats 0.5 as 0-32 (using sixty-fourths)', () => {

0 commit comments

Comments
 (0)