|
| 1 | +describe("CatalogUtils.expandNumbers()", function() { |
| 2 | + |
| 3 | + it("should return empty string for empty string", function() { |
| 4 | + expect(CatalogUtils.expandNumbers("")).toBe(""); |
| 5 | + }) |
| 6 | + |
| 7 | + it("should return null for null", function() { |
| 8 | + expect(CatalogUtils.expandNumbers(null)).toBeNull(); |
| 9 | + }) |
| 10 | + |
| 11 | + it("should return undefined for empty unndefined", function() { |
| 12 | + expect(CatalogUtils.expandNumbers(undefined)).toBeUndefined(); |
| 13 | + }) |
| 14 | + |
| 15 | + it("should return string without hyphen as it", function() { |
| 16 | + expect(CatalogUtils.expandNumbers("test")).toEqual("test"); |
| 17 | + }) |
| 18 | + |
| 19 | + it("should return 'one-two' for 'one-two'", function() { |
| 20 | + expect(CatalogUtils.expandNumbers("one-two")).toEqual("one-two"); |
| 21 | + }) |
| 22 | + |
| 23 | + it("should return '1,2' for '1-2'", function() { |
| 24 | + expect(CatalogUtils.expandNumbers("1-2")).toEqual("1,2"); |
| 25 | + }) |
| 26 | + |
| 27 | + it("should return '1,2,3' for '1-3'", function() { |
| 28 | + expect(CatalogUtils.expandNumbers("1-3")).toEqual("1,2,3"); |
| 29 | + }) |
| 30 | + |
| 31 | + it("should return '10,11' for '10-11'", function() { |
| 32 | + expect(CatalogUtils.expandNumbers("10-11")).toEqual("10,11"); |
| 33 | + }) |
| 34 | + |
| 35 | + it("should return '10,11,12' for '10-12'", function() { |
| 36 | + expect(CatalogUtils.expandNumbers("10-12")).toEqual("10,11,12"); |
| 37 | + }) |
| 38 | + |
| 39 | + it("should return '2415,2416,2417' for '2415-7'", function() { |
| 40 | + expect(CatalogUtils.expandNumbers("2415-7")).toEqual("2415,2416,2417"); |
| 41 | + }) |
| 42 | + |
| 43 | + it("should return '2415,2416,2417' for '2415-17'", function() { |
| 44 | + expect(CatalogUtils.expandNumbers("2415-17")).toEqual("2415,2416,2417"); |
| 45 | + }) |
| 46 | + |
| 47 | + it("should return '2499,2450,2451' for '2499-501'", function() { |
| 48 | + expect(CatalogUtils.expandNumbers("2499-501")).toEqual("2499,2500,2501"); |
| 49 | + }) |
| 50 | + |
| 51 | + it("should return '1,2,3,5,6' for '1-3,5-6'", function() { |
| 52 | + expect(CatalogUtils.expandNumbers("1-3,5-6")).toEqual("1,2,3,5,6"); |
| 53 | + }) |
| 54 | + |
| 55 | + it("should return '1,2,3,5,6,8,9' for '1-3,5-6,8-9'", function() { |
| 56 | + expect(CatalogUtils.expandNumbers("1-3,5-6,8-9")).toEqual("1,2,3,5,6,8,9"); |
| 57 | + }) |
| 58 | + |
| 59 | + it("should return 'test 1-3' for 'test 1-3'", function() { |
| 60 | + expect(CatalogUtils.expandNumbers("test 1-3")).toEqual("test 1-3"); |
| 61 | + }) |
| 62 | + |
| 63 | + it("should return '09-5' for '09-5'", function() { |
| 64 | + expect(CatalogUtils.expandNumbers("09-5")).toEqual("09-5"); |
| 65 | + }) |
| 66 | + |
| 67 | +}); |
0 commit comments