Example #1
0
 it('returns empty array for unexpected input', function () {
     var res = scheduleTools.parseValue('!');
     expect(res.length).toBe(7);
     res.forEach(function (item) {
         expect(item.length).toBe(24);
         item.forEach(function (innerItem) {
             expect(innerItem).toBeNull();
         });
     });
 });
Example #2
0
 it('parses 168-length array to 7x24 length array', function () {
     var arr = getParsedLength168Array();
     var res = scheduleTools.parseValue(arr);
     expect(res.length).toBe(7);
     res.forEach(function (item) {
         expect(item.length).toBe(24);
         item.forEach(function (innerItem) {
             expect(innerItem).toBe('');
         });
     });
 });
Example #3
0
            it('puts correct value in correct pos', function () {
                var arr = getParsedLength168Array();
                // 7th position every day put '1.0'
                arr = JSON.parse(arr);
                _.each(_.range(7, 168, 24), function (v) {
                    arr[v] = '1.0';
                });

                arr = JSON.stringify(arr);
                var res = scheduleTools.parseValue(arr);
                res.forEach(function (item) {
                    expect(item[7]).toBe('1.0');
                });
            });