| 1 | "use strict"; |
| 2 | |
| 3 | var tz = require("../../").tz; |
| 4 | |
| 5 | function compare(test, source, expected) { |
| 6 | var actual = tz.unpack(source); |
| 7 | |
| 8 | test.deepEqual(actual.name, expected.name, 'should be able to unpack name'); |
| 9 | test.deepEqual(actual.abbrs, expected.abbrs, 'should be able to unpack abbrs'); |
| 10 | test.deepEqual(actual.untils, expected.untils, 'should be able to unpack untils'); |
| 11 | test.deepEqual(actual.offsets, expected.offsets, 'should be able to unpack offsets'); |
| 12 | |
| 13 | test.done(); |
| 14 | } |
| 15 | |
| 16 | exports.unpack = { |
| 17 | single : function (test) { |
| 18 | compare(test, |
| 19 | "Some/Zone_Name|ABC DEF GHI|10 3X 10|010121|-1aX 20 3X 20 3X", |
| 20 | { |
| 21 | name : "Some/Zone_Name", |
| 22 | abbrs : ["ABC", "DEF", "ABC", "DEF", "GHI", "DEF"], |
| 23 | offsets : [60, 239, 60, 239, 60, 239], |
| 24 | untils : [ |
| 25 | -4259 * 60000, |
| 26 | -4139 * 60000, |
| 27 | -3900 * 60000, |
| 28 | -3780 * 60000, |
| 29 | -3541 * 60000, |
| 30 | Infinity |
| 31 | ] |
| 32 | } |
| 33 | ); |
| 34 | } |
| 35 | }; |