UNPKG

purespectrum-lib

Version:

shared code between front and backend projects

91 lines 3.6 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var children_label_mapper_1 = require("./children-label-mapper"); var quota_mapper_constants_1 = require("./quota-mapper.constants"); describe('ChildrenLabelMapper', function () { it('Either - 1 year to 3 year', function () { var conditions_codes = [ 134, 136, 135, 138, 137, //Boy Age 3 ]; var childrenLabelMapper = new children_label_mapper_1.ChildrenLabelMapper(conditions_codes); expect(childrenLabelMapper._audiance()).toBe('Either'); expect(childrenLabelMapper.min()).toBe(1); expect(childrenLabelMapper.max()).toBe(3); expect(childrenLabelMapper.label()).toBe('Either, Have Children, 1 - 3, Years'); }); it('Girl - 1 year to 3 year', function () { var conditions_codes = [ 134, 136, 138, //Girl Age 3 ]; var childrenLabelMapper = new children_label_mapper_1.ChildrenLabelMapper(conditions_codes); expect(childrenLabelMapper._audiance()).toBe('Girl'); expect(childrenLabelMapper.min()).toBe(1); expect(childrenLabelMapper.max()).toBe(3); expect(childrenLabelMapper.label()).toBe('Girl, Have Children, 1 - 3, Years'); }); it('Boy - 7 Months to 10 Months', function () { var conditions_codes = [ 129, 123, 127, 125, //Boy 8 months old ]; var childrenLabelMapper = new children_label_mapper_1.ChildrenLabelMapper(conditions_codes, quota_mapper_constants_1.MONTHS_CHILD_AGE_UNIT_CODE); expect(childrenLabelMapper._audiance()).toBe('Boy'); expect(childrenLabelMapper.min()).toBe(7); expect(childrenLabelMapper.max()).toBe(10); expect(childrenLabelMapper.label()).toBe('Boy, Have Children, 7 - 10, Months'); }); it('No Children', function () { var conditions_codes = [ 167, //No Children ]; var childrenLabelMapper = new children_label_mapper_1.ChildrenLabelMapper(conditions_codes); expect(childrenLabelMapper.label()).toBe('No Children'); }); it('Boy - 0 Years to 5 Including Months', function () { var conditionCodes = [ '111', '113', '115', '117', '119', '121', '123', '125', '127', '129', '131', '133', '135', '137', '139', '141', ]; var childrenLabelMapper = new children_label_mapper_1.ChildrenLabelMapper(conditionCodes.map(Number)); var label = childrenLabelMapper.label(); expect(label).toBe('Boy, Have Children, 0 - 5, Years'); }); it('Boy - 1 Years to 3 Including Months upto 47', function () { var conditionCodes = [ '133', '168', '170', '172', '174', '176', '178', '180', '182', '184', '186', '188', '135', '190', '192', '194', '196', '198', '200', '202', '204', '206', '208', '210', '137', '212', '214', '216', '218', '220', '222', '224', '226', '228', '230', '232' ]; var childrenLabelMapper = new children_label_mapper_1.ChildrenLabelMapper(conditionCodes.map(Number)); var label = childrenLabelMapper.label(); expect(label).toBe('Boy, Have Children, 1 - 3, Years'); }); }); //# sourceMappingURL=children-label-mapper.spec.js.map