From 50e20064af14b51ae2e0e930f92b085d3eef2b4f Mon Sep 17 00:00:00 2001 From: Bryan Ingle Date: Wed, 4 May 2022 12:32:09 -0600 Subject: [PATCH] Additional JERQ/DDF "getProducerSymbol" tests for futures options (e.g. ZCN22|800P) --- .../utilities/parsers/SymbolParserSpec.js | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/test/specs/utilities/parsers/SymbolParserSpec.js b/test/specs/utilities/parsers/SymbolParserSpec.js index a17bbe7..ddfc091 100644 --- a/test/specs/utilities/parsers/SymbolParserSpec.js +++ b/test/specs/utilities/parsers/SymbolParserSpec.js @@ -2780,6 +2780,42 @@ describe('When getting a producer symbol', () => { expect(producerSymbol).toEqual('ZWK465X'); }); }); + + describe('When testing ZCN22|800P in 2022', () => { + let producerSymbol; + + beforeEach(() => { + let getFullYear = Date.prototype.getFullYear; + + Date.prototype.getFullYear = () => { return 2022; }; + + producerSymbol = SymbolParser.getProducerSymbol('ZCN22|800P'); + + Date.prototype.getFullYear = getFullYear; + }); + + it('ZCN22|800P should map to ZCN800P', () =>{ + expect(producerSymbol).toEqual('ZCN800P'); + }); + }); + + describe('When testing ZCN2|800P in 2022', () => { + let producerSymbol; + + beforeEach(() => { + let getFullYear = Date.prototype.getFullYear; + + Date.prototype.getFullYear = () => { return 2022; }; + + producerSymbol = SymbolParser.getProducerSymbol('ZCN2|800P'); + + Date.prototype.getFullYear = getFullYear; + }); + + it('ZCN2|800P should map to ZCN800P', () =>{ + expect(producerSymbol).toEqual('ZCN800P'); + }); + }); }); });