From 318f953aca8de4ee682e0fc68d11fee7871d0a3f Mon Sep 17 00:00:00 2001 From: Martin Aspeli Date: Mon, 7 Oct 2013 08:20:31 +0100 Subject: [PATCH] Upgrade buster to 0.7 --- package.json | 2 +- test/crud-test.js | 216 ++++++++++++++++----------------- test/helpers-test.js | 276 +++++++++++++++++++++---------------------- 3 files changed, 247 insertions(+), 247 deletions(-) diff --git a/package.json b/package.json index b9741bc..f6a5982 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "node-zip": "1.0.1" }, "devDependencies": { - "buster": "0.6.13", + "buster": "0.7.6", "grunt": "~0.4.1", "grunt-buster": "~0.2.1" }, diff --git a/test/crud-test.js b/test/crud-test.js index 4cef9f3..f13813a 100644 --- a/test/crud-test.js +++ b/test/crud-test.js @@ -1,5 +1,5 @@ /*jshint globalstrict:true, devel:true */ -/*global require, module, exports, process, __dirname, describe, before, after, it, expect */ +/*global require, module, exports, process, __dirname, describe, before, after, it */ "use strict"; var buster = require('buster'), @@ -23,10 +23,10 @@ describe("CRUD operations", function() { it("can load data", function(done) { fs.readFile(path.join(__dirname, 'templates', 't1.xlsx'), function(err, data) { - expect(err).toBeNull(); + buster.expect(err).toBeNull(); var t = new XlsxTemplate(data); - expect(t.sharedStrings).toEqual([ + buster.expect(t.sharedStrings).toEqual([ "Name", "Role", "Plan table", "${table:planData.name}", "${table:planData.role}", "${table:planData.days}", "${dates}", "${revision}", @@ -41,7 +41,7 @@ describe("CRUD operations", function() { it("can write changed shared strings", function(done) { fs.readFile(path.join(__dirname, 'templates', 't1.xlsx'), function(err, data) { - expect(err).toBeNull(); + buster.expect(err).toBeNull(); var t = new XlsxTemplate(data); @@ -50,8 +50,8 @@ describe("CRUD operations", function() { t.writeSharedStrings(); var text = t.archive.file("xl/sharedStrings.xml").asText(); - expect(text).not.toMatch("Plan table"); - expect(text).toMatch("The plan"); + buster.expect(text).not.toMatch("Plan table"); + buster.expect(text).toMatch("The plan"); done(); }); @@ -61,7 +61,7 @@ describe("CRUD operations", function() { it("can substitute values and generate a file", function(done) { fs.readFile(path.join(__dirname, 'templates', 't1.xlsx'), function(err, data) { - expect(err).toBeNull(); + buster.expect(err).toBeNull(); var t = new XlsxTemplate(data); @@ -93,85 +93,85 @@ describe("CRUD operations", function() { sheet1 = etree.parse(t.archive.file("xl/worksheets/sheet1.xml").asText()).getroot(); // extract date placeholder - interpolated into string referenced at B4 - expect(sheet1.find("./sheetData/row/c[@r='B4']").attrib.t).toEqual("s"); - expect( + buster.expect(sheet1.find("./sheetData/row/c[@r='B4']").attrib.t).toEqual("s"); + buster.expect( sharedStrings.findall("./si")[ parseInt(sheet1.find("./sheetData/row/c[@r='B4']/v").text, 10) ].find("t").text ).toEqual("Extracted on 2013-01-02T00:00:00.000Z"); // revision placeholder - cell C4 changed from string to number - expect(sheet1.find("./sheetData/row/c[@r='C4']").attrib.t).toEqual("n"); - expect(sheet1.find("./sheetData/row/c[@r='C4']/v").text).toEqual("10"); + buster.expect(sheet1.find("./sheetData/row/c[@r='C4']").attrib.t).toEqual("n"); + buster.expect(sheet1.find("./sheetData/row/c[@r='C4']/v").text).toEqual("10"); // dates placeholder - added cells - expect(sheet1.find("./sheetData/row/c[@r='D6']").attrib.t).toEqual("d"); - expect(sheet1.find("./sheetData/row/c[@r='E6']").attrib.t).toEqual("d"); - expect(sheet1.find("./sheetData/row/c[@r='F6']").attrib.t).toEqual("d"); + buster.expect(sheet1.find("./sheetData/row/c[@r='D6']").attrib.t).toEqual("d"); + buster.expect(sheet1.find("./sheetData/row/c[@r='E6']").attrib.t).toEqual("d"); + buster.expect(sheet1.find("./sheetData/row/c[@r='F6']").attrib.t).toEqual("d"); - expect(sheet1.find("./sheetData/row/c[@r='D6']/v").text).toEqual(new Date("2013-01-01").toISOString()); - expect(sheet1.find("./sheetData/row/c[@r='E6']/v").text).toEqual(new Date("2013-01-02").toISOString()); - expect(sheet1.find("./sheetData/row/c[@r='F6']/v").text).toEqual(new Date("2013-01-03").toISOString()); + buster.expect(sheet1.find("./sheetData/row/c[@r='D6']/v").text).toEqual(new Date("2013-01-01").toISOString()); + buster.expect(sheet1.find("./sheetData/row/c[@r='E6']/v").text).toEqual(new Date("2013-01-02").toISOString()); + buster.expect(sheet1.find("./sheetData/row/c[@r='F6']/v").text).toEqual(new Date("2013-01-03").toISOString()); // planData placeholder - added rows and cells - expect(sheet1.find("./sheetData/row/c[@r='B7']").attrib.t).toEqual("s"); - expect( + buster.expect(sheet1.find("./sheetData/row/c[@r='B7']").attrib.t).toEqual("s"); + buster.expect( sharedStrings.findall("./si")[ parseInt(sheet1.find("./sheetData/row/c[@r='B7']/v").text, 10) ].find("t").text ).toEqual("John Smith"); - expect(sheet1.find("./sheetData/row/c[@r='B8']").attrib.t).toEqual("s"); - expect( + buster.expect(sheet1.find("./sheetData/row/c[@r='B8']").attrib.t).toEqual("s"); + buster.expect( sharedStrings.findall("./si")[ parseInt(sheet1.find("./sheetData/row/c[@r='B8']/v").text, 10) ].find("t").text ).toEqual("James Smith"); - expect(sheet1.find("./sheetData/row/c[@r='B9']").attrib.t).toEqual("s"); - expect( + buster.expect(sheet1.find("./sheetData/row/c[@r='B9']").attrib.t).toEqual("s"); + buster.expect( sharedStrings.findall("./si")[ parseInt(sheet1.find("./sheetData/row/c[@r='B9']/v").text, 10) ].find("t").text ).toEqual("Jim Smith"); - expect(sheet1.find("./sheetData/row/c[@r='C7']").attrib.t).toEqual("s"); - expect( + buster.expect(sheet1.find("./sheetData/row/c[@r='C7']").attrib.t).toEqual("s"); + buster.expect( sharedStrings.findall("./si")[ parseInt(sheet1.find("./sheetData/row/c[@r='C7']/v").text, 10) ].find("t").text ).toEqual("Developer"); - expect(sheet1.find("./sheetData/row/c[@r='C8']").attrib.t).toEqual("s"); - expect( + buster.expect(sheet1.find("./sheetData/row/c[@r='C8']").attrib.t).toEqual("s"); + buster.expect( sharedStrings.findall("./si")[ parseInt(sheet1.find("./sheetData/row/c[@r='C8']/v").text, 10) ].find("t").text ).toEqual("Analyst"); - expect(sheet1.find("./sheetData/row/c[@r='C9']").attrib.t).toEqual("s"); - expect( + buster.expect(sheet1.find("./sheetData/row/c[@r='C9']").attrib.t).toEqual("s"); + buster.expect( sharedStrings.findall("./si")[ parseInt(sheet1.find("./sheetData/row/c[@r='C9']/v").text, 10) ].find("t").text ).toEqual("Manager"); - expect(sheet1.find("./sheetData/row/c[@r='D7']").attrib.t).toEqual("n"); - expect(sheet1.find("./sheetData/row/c[@r='D7']/v").text).toEqual("8"); - expect(sheet1.find("./sheetData/row/c[@r='D8']").attrib.t).toEqual("n"); - expect(sheet1.find("./sheetData/row/c[@r='D8']/v").text).toEqual("4"); - expect(sheet1.find("./sheetData/row/c[@r='D9']").attrib.t).toEqual("n"); - expect(sheet1.find("./sheetData/row/c[@r='D9']/v").text).toEqual("4"); - - expect(sheet1.find("./sheetData/row/c[@r='E7']").attrib.t).toEqual("n"); - expect(sheet1.find("./sheetData/row/c[@r='E7']/v").text).toEqual("8"); - expect(sheet1.find("./sheetData/row/c[@r='E8']").attrib.t).toEqual("n"); - expect(sheet1.find("./sheetData/row/c[@r='E8']/v").text).toEqual("4"); - expect(sheet1.find("./sheetData/row/c[@r='E9']").attrib.t).toEqual("n"); - expect(sheet1.find("./sheetData/row/c[@r='E9']/v").text).toEqual("4"); - - expect(sheet1.find("./sheetData/row/c[@r='F7']").attrib.t).toEqual("n"); - expect(sheet1.find("./sheetData/row/c[@r='F7']/v").text).toEqual("4"); - expect(sheet1.find("./sheetData/row/c[@r='F8']").attrib.t).toEqual("n"); - expect(sheet1.find("./sheetData/row/c[@r='F8']/v").text).toEqual("4"); - expect(sheet1.find("./sheetData/row/c[@r='F9']").attrib.t).toEqual("n"); - expect(sheet1.find("./sheetData/row/c[@r='F9']/v").text).toEqual("4"); + buster.expect(sheet1.find("./sheetData/row/c[@r='D7']").attrib.t).toEqual("n"); + buster.expect(sheet1.find("./sheetData/row/c[@r='D7']/v").text).toEqual("8"); + buster.expect(sheet1.find("./sheetData/row/c[@r='D8']").attrib.t).toEqual("n"); + buster.expect(sheet1.find("./sheetData/row/c[@r='D8']/v").text).toEqual("4"); + buster.expect(sheet1.find("./sheetData/row/c[@r='D9']").attrib.t).toEqual("n"); + buster.expect(sheet1.find("./sheetData/row/c[@r='D9']/v").text).toEqual("4"); + + buster.expect(sheet1.find("./sheetData/row/c[@r='E7']").attrib.t).toEqual("n"); + buster.expect(sheet1.find("./sheetData/row/c[@r='E7']/v").text).toEqual("8"); + buster.expect(sheet1.find("./sheetData/row/c[@r='E8']").attrib.t).toEqual("n"); + buster.expect(sheet1.find("./sheetData/row/c[@r='E8']/v").text).toEqual("4"); + buster.expect(sheet1.find("./sheetData/row/c[@r='E9']").attrib.t).toEqual("n"); + buster.expect(sheet1.find("./sheetData/row/c[@r='E9']/v").text).toEqual("4"); + + buster.expect(sheet1.find("./sheetData/row/c[@r='F7']").attrib.t).toEqual("n"); + buster.expect(sheet1.find("./sheetData/row/c[@r='F7']/v").text).toEqual("4"); + buster.expect(sheet1.find("./sheetData/row/c[@r='F8']").attrib.t).toEqual("n"); + buster.expect(sheet1.find("./sheetData/row/c[@r='F8']/v").text).toEqual("4"); + buster.expect(sheet1.find("./sheetData/row/c[@r='F9']").attrib.t).toEqual("n"); + buster.expect(sheet1.find("./sheetData/row/c[@r='F9']/v").text).toEqual("4"); // XXX: For debugging only // fs.writeFileSync('test.xlsx', newData, 'binary'); @@ -184,7 +184,7 @@ describe("CRUD operations", function() { it("moves columns left or right when filling lists", function(done) { fs.readFile(path.join(__dirname, 'templates', 'test-cols.xlsx'), function(err, data) { - expect(err).toBeNull(); + buster.expect(err).toBeNull(); var t = new XlsxTemplate(data); @@ -201,25 +201,25 @@ describe("CRUD operations", function() { sheet1 = etree.parse(t.archive.file("xl/worksheets/sheet1.xml").asText()).getroot(); // C4 should have moved left, and the old B4 should now be deleted - expect(sheet1.find("./sheetData/row/c[@r='B4']/v").text).toEqual("101"); - expect(sheet1.find("./sheetData/row/c[@r='C4']")).toBeNull(); + buster.expect(sheet1.find("./sheetData/row/c[@r='B4']/v").text).toEqual("101"); + buster.expect(sheet1.find("./sheetData/row/c[@r='C4']")).toBeNull(); // C5 should have moved right, and the old B5 should now be expanded - expect( + buster.expect( sharedStrings.findall("./si")[ parseInt(sheet1.find("./sheetData/row/c[@r='B5']/v").text, 10) ].find("t").text ).toEqual("one"); - expect( + buster.expect( sharedStrings.findall("./si")[ parseInt(sheet1.find("./sheetData/row/c[@r='C5']/v").text, 10) ].find("t").text ).toEqual("two"); - expect(sheet1.find("./sheetData/row/c[@r='D5']/v").text).toEqual("102"); + buster.expect(sheet1.find("./sheetData/row/c[@r='D5']/v").text).toEqual("102"); // C6 should not have moved, and the old B6 should be replaced - expect(sheet1.find("./sheetData/row/c[@r='B6']/v").text).toEqual("10"); - expect(sheet1.find("./sheetData/row/c[@r='C6']/v").text).toEqual("103"); + buster.expect(sheet1.find("./sheetData/row/c[@r='B6']/v").text).toEqual("10"); + buster.expect(sheet1.find("./sheetData/row/c[@r='C6']/v").text).toEqual("103"); // XXX: For debugging only // fs.writeFileSync('test.xlsx', newData, 'binary'); @@ -232,7 +232,7 @@ describe("CRUD operations", function() { it("moves rows down when filling tables", function(done) { fs.readFile(path.join(__dirname, 'templates', 'test-tables.xlsx'), function(err, data) { - expect(err).toBeNull(); + buster.expect(err).toBeNull(); var t = new XlsxTemplate(data); @@ -254,109 +254,109 @@ describe("CRUD operations", function() { sheet1 = etree.parse(t.archive.file("xl/worksheets/sheet1.xml").asText()).getroot(); // Marker above table hasn't moved - expect(sheet1.find("./sheetData/row/c[@r='B4']/v").text).toEqual("101"); + buster.expect(sheet1.find("./sheetData/row/c[@r='B4']/v").text).toEqual("101"); // Headers on row 6 haven't moved - expect( + buster.expect( sharedStrings.findall("./si")[ parseInt(sheet1.find("./sheetData/row/c[@r='B6']/v").text, 10) ].find("t").text ).toEqual("Name"); - expect( + buster.expect( sharedStrings.findall("./si")[ parseInt(sheet1.find("./sheetData/row/c[@r='C6']/v").text, 10) ].find("t").text ).toEqual("Age"); - expect( + buster.expect( sharedStrings.findall("./si")[ parseInt(sheet1.find("./sheetData/row/c[@r='E6']/v").text, 10) ].find("t").text ).toEqual("Name"); - expect( + buster.expect( sharedStrings.findall("./si")[ parseInt(sheet1.find("./sheetData/row/c[@r='F6']/v").text, 10) ].find("t").text ).toEqual("Score"); // Rows 7 contains table values for the two tables, plus the original marker in G7 - expect( + buster.expect( sharedStrings.findall("./si")[ parseInt(sheet1.find("./sheetData/row/c[@r='B7']/v").text, 10) ].find("t").text ).toEqual("John"); - expect(sheet1.find("./sheetData/row/c[@r='C7']/v").text).toEqual("10"); + buster.expect(sheet1.find("./sheetData/row/c[@r='C7']/v").text).toEqual("10"); - expect( + buster.expect( sharedStrings.findall("./si")[ parseInt(sheet1.find("./sheetData/row/c[@r='E7']/v").text, 10) ].find("t").text ).toEqual("John"); - expect(sheet1.find("./sheetData/row/c[@r='F7']/v").text).toEqual("100"); + buster.expect(sheet1.find("./sheetData/row/c[@r='F7']/v").text).toEqual("100"); - expect(sheet1.find("./sheetData/row/c[@r='G7']/v").text).toEqual("102"); + buster.expect(sheet1.find("./sheetData/row/c[@r='G7']/v").text).toEqual("102"); // Row 8 contains table values, and no markers - expect( + buster.expect( sharedStrings.findall("./si")[ parseInt(sheet1.find("./sheetData/row/c[@r='B8']/v").text, 10) ].find("t").text ).toEqual("Bob"); - expect(sheet1.find("./sheetData/row/c[@r='C8']/v").text).toEqual("2"); + buster.expect(sheet1.find("./sheetData/row/c[@r='C8']/v").text).toEqual("2"); - expect( + buster.expect( sharedStrings.findall("./si")[ parseInt(sheet1.find("./sheetData/row/c[@r='E8']/v").text, 10) ].find("t").text ).toEqual("Bob"); - expect(sheet1.find("./sheetData/row/c[@r='F8']/v").text).toEqual("110"); + buster.expect(sheet1.find("./sheetData/row/c[@r='F8']/v").text).toEqual("110"); - expect(sheet1.find("./sheetData/row/c[@r='G8']")).toBeNull(); + buster.expect(sheet1.find("./sheetData/row/c[@r='G8']")).toBeNull(); // Row 9 contains no values for the first table, and again no markers - expect(sheet1.find("./sheetData/row/c[@r='B9']")).toBeNull(); - expect(sheet1.find("./sheetData/row/c[@r='C9']")).toBeNull(); + buster.expect(sheet1.find("./sheetData/row/c[@r='B9']")).toBeNull(); + buster.expect(sheet1.find("./sheetData/row/c[@r='C9']")).toBeNull(); - expect( + buster.expect( sharedStrings.findall("./si")[ parseInt(sheet1.find("./sheetData/row/c[@r='E9']/v").text, 10) ].find("t").text ).toEqual("Jim"); - expect(sheet1.find("./sheetData/row/c[@r='F9']/v").text).toEqual("120"); + buster.expect(sheet1.find("./sheetData/row/c[@r='F9']/v").text).toEqual("120"); - expect(sheet1.find("./sheetData/row/c[@r='G8']")).toBeNull(); + buster.expect(sheet1.find("./sheetData/row/c[@r='G8']")).toBeNull(); // Row 12 contains two blank cells and a marker - expect(sheet1.find("./sheetData/row/c[@r='B12']/v")).toBeNull(); - expect(sheet1.find("./sheetData/row/c[@r='C12']/v")).toBeNull(); - expect(sheet1.find("./sheetData/row/c[@r='D12']/v").text).toEqual("103"); + buster.expect(sheet1.find("./sheetData/row/c[@r='B12']/v")).toBeNull(); + buster.expect(sheet1.find("./sheetData/row/c[@r='C12']/v")).toBeNull(); + buster.expect(sheet1.find("./sheetData/row/c[@r='D12']/v").text).toEqual("103"); // Row 15 contains a name, two dates, and a placeholder that was shifted to the right - expect( + buster.expect( sharedStrings.findall("./si")[ parseInt(sheet1.find("./sheetData/row/c[@r='B15']/v").text, 10) ].find("t").text ).toEqual("John"); - expect(sheet1.find("./sheetData/row/c[@r='C15']/v").text).toEqual(new Date("2013-01-01").toISOString()); - expect(sheet1.find("./sheetData/row/c[@r='D15']/v").text).toEqual(new Date("2013-01-02").toISOString()); - expect(sheet1.find("./sheetData/row/c[@r='E15']/v").text).toEqual("104"); + buster.expect(sheet1.find("./sheetData/row/c[@r='C15']/v").text).toEqual(new Date("2013-01-01").toISOString()); + buster.expect(sheet1.find("./sheetData/row/c[@r='D15']/v").text).toEqual(new Date("2013-01-02").toISOString()); + buster.expect(sheet1.find("./sheetData/row/c[@r='E15']/v").text).toEqual("104"); // Row 16 contains a name and three dates - expect( + buster.expect( sharedStrings.findall("./si")[ parseInt(sheet1.find("./sheetData/row/c[@r='B16']/v").text, 10) ].find("t").text ).toEqual("Bob"); - expect(sheet1.find("./sheetData/row/c[@r='C16']/v").text).toEqual(new Date("2013-01-01").toISOString()); - expect(sheet1.find("./sheetData/row/c[@r='D16']/v").text).toEqual(new Date("2013-01-02").toISOString()); - expect(sheet1.find("./sheetData/row/c[@r='E16']/v").text).toEqual(new Date("2013-01-03").toISOString()); + buster.expect(sheet1.find("./sheetData/row/c[@r='C16']/v").text).toEqual(new Date("2013-01-01").toISOString()); + buster.expect(sheet1.find("./sheetData/row/c[@r='D16']/v").text).toEqual(new Date("2013-01-02").toISOString()); + buster.expect(sheet1.find("./sheetData/row/c[@r='E16']/v").text).toEqual(new Date("2013-01-03").toISOString()); // Row 17 contains a name and no dates - expect( + buster.expect( sharedStrings.findall("./si")[ parseInt(sheet1.find("./sheetData/row/c[@r='B17']/v").text, 10) ].find("t").text ).toEqual("Jim"); - expect(sheet1.find("./sheetData/row/c[@r='C17']")).toBeNull(); + buster.expect(sheet1.find("./sheetData/row/c[@r='C17']")).toBeNull(); // XXX: For debugging only // fs.writeFileSync('test.xlsx', newData, 'binary'); @@ -369,7 +369,7 @@ describe("CRUD operations", function() { it("moves named tables, named cells and merged cells", function(done) { fs.readFile(path.join(__dirname, 'templates', 'test-named-tables.xlsx'), function(err, data) { - expect(err).toBeNull(); + buster.expect(err).toBeNull(); var t = new XlsxTemplate(data); @@ -397,30 +397,30 @@ describe("CRUD operations", function() { table3 = etree.parse(t.archive.file("xl/tables/table3.xml").asText()).getroot(); // Named ranges have moved - expect(workbook.find("./definedNames/definedName[@name='BelowTable']").text).toEqual("Tables!$B$18"); - expect(workbook.find("./definedNames/definedName[@name='Moving']").text).toEqual("Tables!$G$8"); - expect(workbook.find("./definedNames/definedName[@name='RangeBelowTable']").text).toEqual("Tables!$B$19:$C$19"); - expect(workbook.find("./definedNames/definedName[@name='RangeRightOfTable']").text).toEqual("Tables!$E$14:$F$14"); - expect(workbook.find("./definedNames/definedName[@name='RightOfTable']").text).toEqual("Tables!$F$8"); + buster.expect(workbook.find("./definedNames/definedName[@name='BelowTable']").text).toEqual("Tables!$B$18"); + buster.expect(workbook.find("./definedNames/definedName[@name='Moving']").text).toEqual("Tables!$G$8"); + buster.expect(workbook.find("./definedNames/definedName[@name='RangeBelowTable']").text).toEqual("Tables!$B$19:$C$19"); + buster.expect(workbook.find("./definedNames/definedName[@name='RangeRightOfTable']").text).toEqual("Tables!$E$14:$F$14"); + buster.expect(workbook.find("./definedNames/definedName[@name='RightOfTable']").text).toEqual("Tables!$F$8"); // Merged cells have moved - expect(sheet1.find("./mergeCells/mergeCell[@ref='B2:C2']")).not.toBeNull(); // title - unchanged + buster.expect(sheet1.find("./mergeCells/mergeCell[@ref='B2:C2']")).not.toBeNull(); // title - unchanged - expect(sheet1.find("./mergeCells/mergeCell[@ref='B10:C10']")).toBeNull(); // pushed down - expect(sheet1.find("./mergeCells/mergeCell[@ref='B12:C12']")).not.toBeNull(); // pushed down + buster.expect(sheet1.find("./mergeCells/mergeCell[@ref='B10:C10']")).toBeNull(); // pushed down + buster.expect(sheet1.find("./mergeCells/mergeCell[@ref='B12:C12']")).not.toBeNull(); // pushed down - expect(sheet1.find("./mergeCells/mergeCell[@ref='E7:F7']")).toBeNull(); // pushed down and accross - expect(sheet1.find("./mergeCells/mergeCell[@ref='G8:H8']")).not.toBeNull(); // pushed down and accross + buster.expect(sheet1.find("./mergeCells/mergeCell[@ref='E7:F7']")).toBeNull(); // pushed down and accross + buster.expect(sheet1.find("./mergeCells/mergeCell[@ref='G8:H8']")).not.toBeNull(); // pushed down and accross // Table ranges and autofilter definitions have moved - expect(table1.attrib.ref).toEqual("B4:C6"); // Grown - expect(table1.find("./autoFilter").attrib.ref).toEqual("B4:C6"); // Grown + buster.expect(table1.attrib.ref).toEqual("B4:C6"); // Grown + buster.expect(table1.find("./autoFilter").attrib.ref).toEqual("B4:C6"); // Grown - expect(table2.attrib.ref).toEqual("B8:E10"); // Grown and pushed down - expect(table2.find("./autoFilter").attrib.ref).toEqual("B8:E10"); // Grown and pushed down + buster.expect(table2.attrib.ref).toEqual("B8:E10"); // Grown and pushed down + buster.expect(table2.find("./autoFilter").attrib.ref).toEqual("B8:E10"); // Grown and pushed down - expect(table3.attrib.ref).toEqual("C14:D16"); // Grown and pushed down - expect(table3.find("./autoFilter").attrib.ref).toEqual("C14:D16"); // Grown and pushed down + buster.expect(table3.attrib.ref).toEqual("C14:D16"); // Grown and pushed down + buster.expect(table3.find("./autoFilter").attrib.ref).toEqual("C14:D16"); // Grown and pushed down // XXX: For debugging only // fs.writeFileSync('test.xlsx', newData, 'binary'); diff --git a/test/helpers-test.js b/test/helpers-test.js index 8747512..64a641e 100644 --- a/test/helpers-test.js +++ b/test/helpers-test.js @@ -1,5 +1,5 @@ /*jshint globalstrict:true, devel:true */ -/*global require, module, exports, process, __dirname, describe, before, after, it, expect */ +/*global require, module, exports, process, __dirname, describe, before, after, it */ "use strict"; var buster = require('buster'), @@ -18,10 +18,10 @@ describe("Helpers", function() { it("adds new strings to the index if required", function() { var t = new XlsxTemplate(); - expect(t.stringIndex("foo")).toEqual(0); - expect(t.stringIndex("bar")).toEqual(1); - expect(t.stringIndex("foo")).toEqual(0); - expect(t.stringIndex("baz")).toEqual(2); + buster.expect(t.stringIndex("foo")).toEqual(0); + buster.expect(t.stringIndex("bar")).toEqual(1); + buster.expect(t.stringIndex("foo")).toEqual(0); + buster.expect(t.stringIndex("baz")).toEqual(2); }); }); @@ -31,9 +31,9 @@ describe("Helpers", function() { it("adds new string if old string not found", function() { var t = new XlsxTemplate(); - expect(t.replaceString("foo", "bar")).toEqual(0); - expect(t.sharedStrings).toEqual(["bar"]); - expect(t.sharedStringsLookup).toEqual({"bar": 0}); + buster.expect(t.replaceString("foo", "bar")).toEqual(0); + buster.expect(t.sharedStrings).toEqual(["bar"]); + buster.expect(t.sharedStringsLookup).toEqual({"bar": 0}); }); it("replaces strings if found", function() { @@ -42,9 +42,9 @@ describe("Helpers", function() { t.addSharedString("foo"); t.addSharedString("baz"); - expect(t.replaceString("foo", "bar")).toEqual(0); - expect(t.sharedStrings).toEqual(["bar", "baz"]); - expect(t.sharedStringsLookup).toEqual({"bar": 0, "baz": 1}); + buster.expect(t.replaceString("foo", "bar")).toEqual(0); + buster.expect(t.sharedStrings).toEqual(["bar", "baz"]); + buster.expect(t.sharedStringsLookup).toEqual({"bar": 0, "baz": 1}); }); }); @@ -54,7 +54,7 @@ describe("Helpers", function() { it("can extract simple placeholders", function() { var t = new XlsxTemplate(); - expect(t.extractPlaceholders("${foo}")).toEqual([{ + buster.expect(t.extractPlaceholders("${foo}")).toEqual([{ full: true, key: undefined, name: "foo", @@ -66,7 +66,7 @@ describe("Helpers", function() { it("can extract simple placeholders inside strings", function() { var t = new XlsxTemplate(); - expect(t.extractPlaceholders("A string ${foo} bar")).toEqual([{ + buster.expect(t.extractPlaceholders("A string ${foo} bar")).toEqual([{ full: false, key: undefined, name: "foo", @@ -78,7 +78,7 @@ describe("Helpers", function() { it("can extract multiple placeholders from one string", function() { var t = new XlsxTemplate(); - expect(t.extractPlaceholders("${foo} ${bar}")).toEqual([{ + buster.expect(t.extractPlaceholders("${foo} ${bar}")).toEqual([{ full: false, key: undefined, name: "foo", @@ -96,7 +96,7 @@ describe("Helpers", function() { it("can extract placeholders with keys", function() { var t = new XlsxTemplate(); - expect(t.extractPlaceholders("${foo.bar}")).toEqual([{ + buster.expect(t.extractPlaceholders("${foo.bar}")).toEqual([{ full: true, key: "bar", name: "foo", @@ -108,7 +108,7 @@ describe("Helpers", function() { it("can extract placeholders with types", function() { var t = new XlsxTemplate(); - expect(t.extractPlaceholders("${table:foo}")).toEqual([{ + buster.expect(t.extractPlaceholders("${table:foo}")).toEqual([{ full: true, key: undefined, name: "foo", @@ -120,7 +120,7 @@ describe("Helpers", function() { it("can extract placeholders with types and keys", function() { var t = new XlsxTemplate(); - expect(t.extractPlaceholders("${table:foo.bar}")).toEqual([{ + buster.expect(t.extractPlaceholders("${table:foo.bar}")).toEqual([{ full: true, key: "bar", name: "foo", @@ -132,7 +132,7 @@ describe("Helpers", function() { it("can handle strings with no placeholders", function() { var t = new XlsxTemplate(); - expect(t.extractPlaceholders("A string")).toEqual([]); + buster.expect(t.extractPlaceholders("A string")).toEqual([]); }); }); @@ -141,16 +141,16 @@ describe("Helpers", function() { it("Returns true if there is a colon", function() { var t = new XlsxTemplate(); - expect(t.isRange("A1:A2")).toEqual(true); - expect(t.isRange("$A$1:$A$2")).toEqual(true); - expect(t.isRange("Table!$A$1:$A$2")).toEqual(true); + buster.expect(t.isRange("A1:A2")).toEqual(true); + buster.expect(t.isRange("$A$1:$A$2")).toEqual(true); + buster.expect(t.isRange("Table!$A$1:$A$2")).toEqual(true); }); it("Returns false if there is not a colon", function() { var t = new XlsxTemplate(); - expect(t.isRange("A1")).toEqual(false); - expect(t.isRange("$A$1")).toEqual(false); - expect(t.isRange("Table!$A$1")).toEqual(false); + buster.expect(t.isRange("A1")).toEqual(false); + buster.expect(t.isRange("$A$1")).toEqual(false); + buster.expect(t.isRange("Table!$A$1")).toEqual(false); }); }); @@ -159,28 +159,28 @@ describe("Helpers", function() { it("splits single digit and letter values", function() { var t = new XlsxTemplate(); - expect(t.splitRef("A1")).toEqual({table: null, col: "A", colAbsolute: false, row: 1, rowAbsolute: false}); + buster.expect(t.splitRef("A1")).toEqual({table: null, col: "A", colAbsolute: false, row: 1, rowAbsolute: false}); }); it("splits multiple digit and letter values", function() { var t = new XlsxTemplate(); - expect(t.splitRef("AB12")).toEqual({table: null, col: "AB", colAbsolute: false, row: 12, rowAbsolute: false}); + buster.expect(t.splitRef("AB12")).toEqual({table: null, col: "AB", colAbsolute: false, row: 12, rowAbsolute: false}); }); it("splits absolute references", function() { var t = new XlsxTemplate(); - expect(t.splitRef("$AB12")).toEqual({table: null, col: "AB", colAbsolute: true, row: 12, rowAbsolute: false}); - expect(t.splitRef("AB$12")).toEqual({table: null, col: "AB", colAbsolute: false, row: 12, rowAbsolute: true}); - expect(t.splitRef("$AB$12")).toEqual({table: null, col: "AB", colAbsolute: true, row: 12, rowAbsolute: true}); + buster.expect(t.splitRef("$AB12")).toEqual({table: null, col: "AB", colAbsolute: true, row: 12, rowAbsolute: false}); + buster.expect(t.splitRef("AB$12")).toEqual({table: null, col: "AB", colAbsolute: false, row: 12, rowAbsolute: true}); + buster.expect(t.splitRef("$AB$12")).toEqual({table: null, col: "AB", colAbsolute: true, row: 12, rowAbsolute: true}); }); it("splits references with tables", function() { var t = new XlsxTemplate(); - expect(t.splitRef("Table one!AB12")).toEqual({table: "Table one", col: "AB", colAbsolute: false, row: 12, rowAbsolute: false}); - expect(t.splitRef("Table one!$AB12")).toEqual({table: "Table one", col: "AB", colAbsolute: true, row: 12, rowAbsolute: false}); - expect(t.splitRef("Table one!$AB12")).toEqual({table: "Table one", col: "AB", colAbsolute: true, row: 12, rowAbsolute: false}); - expect(t.splitRef("Table one!AB$12")).toEqual({table: "Table one", col: "AB", colAbsolute: false, row: 12, rowAbsolute: true}); - expect(t.splitRef("Table one!$AB$12")).toEqual({table: "Table one", col: "AB", colAbsolute: true, row: 12, rowAbsolute: true}); + buster.expect(t.splitRef("Table one!AB12")).toEqual({table: "Table one", col: "AB", colAbsolute: false, row: 12, rowAbsolute: false}); + buster.expect(t.splitRef("Table one!$AB12")).toEqual({table: "Table one", col: "AB", colAbsolute: true, row: 12, rowAbsolute: false}); + buster.expect(t.splitRef("Table one!$AB12")).toEqual({table: "Table one", col: "AB", colAbsolute: true, row: 12, rowAbsolute: false}); + buster.expect(t.splitRef("Table one!AB$12")).toEqual({table: "Table one", col: "AB", colAbsolute: false, row: 12, rowAbsolute: true}); + buster.expect(t.splitRef("Table one!$AB$12")).toEqual({table: "Table one", col: "AB", colAbsolute: true, row: 12, rowAbsolute: true}); }); }); @@ -189,12 +189,12 @@ describe("Helpers", function() { it("splits single digit and letter values", function() { var t = new XlsxTemplate(); - expect(t.splitRange("A1:B1")).toEqual({start: "A1", end: "B1"}); + buster.expect(t.splitRange("A1:B1")).toEqual({start: "A1", end: "B1"}); }); it("splits multiple digit and letter values", function() { var t = new XlsxTemplate(); - expect(t.splitRange("AB12:CC13")).toEqual({start: "AB12", end: "CC13"}); + buster.expect(t.splitRange("AB12:CC13")).toEqual({start: "AB12", end: "CC13"}); }); }); @@ -203,12 +203,12 @@ describe("Helpers", function() { it("join single digit and letter values", function() { var t = new XlsxTemplate(); - expect(t.joinRange({start: "A1", end: "B1"})).toEqual("A1:B1"); + buster.expect(t.joinRange({start: "A1", end: "B1"})).toEqual("A1:B1"); }); it("join multiple digit and letter values", function() { var t = new XlsxTemplate(); - expect(t.joinRange({start: "AB12", end: "CC13"})).toEqual("AB12:CC13"); + buster.expect(t.joinRange({start: "AB12", end: "CC13"})).toEqual("AB12:CC13"); }); }); @@ -217,26 +217,26 @@ describe("Helpers", function() { it("joins single digit and letter values", function() { var t = new XlsxTemplate(); - expect(t.joinRef({col: "A", row: 1})).toEqual("A1"); + buster.expect(t.joinRef({col: "A", row: 1})).toEqual("A1"); }); it("joins multiple digit and letter values", function() { var t = new XlsxTemplate(); - expect(t.joinRef({col: "AB", row: 12})).toEqual("AB12"); + buster.expect(t.joinRef({col: "AB", row: 12})).toEqual("AB12"); }); it("joins multiple digit and letter values and absolute references", function() { var t = new XlsxTemplate(); - expect(t.joinRef({col: "AB", colAbsolute: true, row: 12, rowAbsolute: false})).toEqual("$AB12"); - expect(t.joinRef({col: "AB", colAbsolute: true, row: 12, rowAbsolute: true})).toEqual("$AB$12"); - expect(t.joinRef({col: "AB", colAbsolute: false, row: 12, rowAbsolute: false})).toEqual("AB12"); + buster.expect(t.joinRef({col: "AB", colAbsolute: true, row: 12, rowAbsolute: false})).toEqual("$AB12"); + buster.expect(t.joinRef({col: "AB", colAbsolute: true, row: 12, rowAbsolute: true})).toEqual("$AB$12"); + buster.expect(t.joinRef({col: "AB", colAbsolute: false, row: 12, rowAbsolute: false})).toEqual("AB12"); }); it("joins multiple digit and letter values and tables", function() { var t = new XlsxTemplate(); - expect(t.joinRef({table: "Table one", col: "AB", colAbsolute: true, row: 12, rowAbsolute: false})).toEqual("Table one!$AB12"); - expect(t.joinRef({table: "Table one", col: "AB", colAbsolute: true, row: 12, rowAbsolute: true})).toEqual("Table one!$AB$12"); - expect(t.joinRef({table: "Table one", col: "AB", colAbsolute: false, row: 12, rowAbsolute: false})).toEqual("Table one!AB12"); + buster.expect(t.joinRef({table: "Table one", col: "AB", colAbsolute: true, row: 12, rowAbsolute: false})).toEqual("Table one!$AB12"); + buster.expect(t.joinRef({table: "Table one", col: "AB", colAbsolute: true, row: 12, rowAbsolute: true})).toEqual("Table one!$AB$12"); + buster.expect(t.joinRef({table: "Table one", col: "AB", colAbsolute: false, row: 12, rowAbsolute: false})).toEqual("Table one!AB12"); }); }); @@ -246,41 +246,41 @@ describe("Helpers", function() { it("increments single columns", function() { var t = new XlsxTemplate(); - expect(t.nextCol("A1")).toEqual("B1"); - expect(t.nextCol("B1")).toEqual("C1"); + buster.expect(t.nextCol("A1")).toEqual("B1"); + buster.expect(t.nextCol("B1")).toEqual("C1"); }); it("maintains row index", function() { var t = new XlsxTemplate(); - expect(t.nextCol("A99")).toEqual("B99"); - expect(t.nextCol("B11231")).toEqual("C11231"); + buster.expect(t.nextCol("A99")).toEqual("B99"); + buster.expect(t.nextCol("B11231")).toEqual("C11231"); }); it("captialises letters", function() { var t = new XlsxTemplate(); - expect(t.nextCol("a1")).toEqual("B1"); - expect(t.nextCol("b1")).toEqual("C1"); + buster.expect(t.nextCol("a1")).toEqual("B1"); + buster.expect(t.nextCol("b1")).toEqual("C1"); }); it("increments the last letter of double columns", function() { var t = new XlsxTemplate(); - expect(t.nextCol("AA12")).toEqual("AB12"); + buster.expect(t.nextCol("AA12")).toEqual("AB12"); }); it("rolls over from Z to A and increments the preceding letter", function() { var t = new XlsxTemplate(); - expect(t.nextCol("AZ12")).toEqual("BA12"); + buster.expect(t.nextCol("AZ12")).toEqual("BA12"); }); it("rolls over from Z to A and adds a new letter if required", function() { var t = new XlsxTemplate(); - expect(t.nextCol("Z12")).toEqual("AA12"); - expect(t.nextCol("ZZ12")).toEqual("AAA12"); + buster.expect(t.nextCol("Z12")).toEqual("AA12"); + buster.expect(t.nextCol("ZZ12")).toEqual("AAA12"); }); }); @@ -290,24 +290,24 @@ describe("Helpers", function() { it("increments single digit rows", function() { var t = new XlsxTemplate(); - expect(t.nextRow("A1")).toEqual("A2"); - expect(t.nextRow("B1")).toEqual("B2"); - expect(t.nextRow("AZ2")).toEqual("AZ3"); + buster.expect(t.nextRow("A1")).toEqual("A2"); + buster.expect(t.nextRow("B1")).toEqual("B2"); + buster.expect(t.nextRow("AZ2")).toEqual("AZ3"); }); it("captialises letters", function() { var t = new XlsxTemplate(); - expect(t.nextRow("a1")).toEqual("A2"); - expect(t.nextRow("b1")).toEqual("B2"); + buster.expect(t.nextRow("a1")).toEqual("A2"); + buster.expect(t.nextRow("b1")).toEqual("B2"); }); it("increments multi digit rows", function() { var t = new XlsxTemplate(); - expect(t.nextRow("A12")).toEqual("A13"); - expect(t.nextRow("AZ12")).toEqual("AZ13"); - expect(t.nextRow("A123")).toEqual("A124"); + buster.expect(t.nextRow("A12")).toEqual("A13"); + buster.expect(t.nextRow("AZ12")).toEqual("AZ13"); + buster.expect(t.nextRow("A123")).toEqual("A124"); }); }); @@ -317,25 +317,25 @@ describe("Helpers", function() { it("can return single letter numbers", function() { var t = new XlsxTemplate(); - expect(t.charToNum("A")).toEqual(1); - expect(t.charToNum("B")).toEqual(2); - expect(t.charToNum("Z")).toEqual(26); + buster.expect(t.charToNum("A")).toEqual(1); + buster.expect(t.charToNum("B")).toEqual(2); + buster.expect(t.charToNum("Z")).toEqual(26); }); it("can return double letter numbers", function() { var t = new XlsxTemplate(); - expect(t.charToNum("AA")).toEqual(27); - expect(t.charToNum("AZ")).toEqual(52); - expect(t.charToNum("BZ")).toEqual(78); + buster.expect(t.charToNum("AA")).toEqual(27); + buster.expect(t.charToNum("AZ")).toEqual(52); + buster.expect(t.charToNum("BZ")).toEqual(78); }); it("can return triple letter numbers", function() { var t = new XlsxTemplate(); - expect(t.charToNum("AAA")).toEqual(703); - expect(t.charToNum("AAZ")).toEqual(728); - expect(t.charToNum("ADI")).toEqual(789); + buster.expect(t.charToNum("AAA")).toEqual(703); + buster.expect(t.charToNum("AAZ")).toEqual(728); + buster.expect(t.charToNum("ADI")).toEqual(789); }); }); @@ -345,25 +345,25 @@ describe("Helpers", function() { it("can convert single letter numbers", function() { var t = new XlsxTemplate(); - expect(t.numToChar(1)).toEqual("A"); - expect(t.numToChar(2)).toEqual("B"); - expect(t.numToChar(26)).toEqual("Z"); + buster.expect(t.numToChar(1)).toEqual("A"); + buster.expect(t.numToChar(2)).toEqual("B"); + buster.expect(t.numToChar(26)).toEqual("Z"); }); it("can convert double letter numbers", function() { var t = new XlsxTemplate(); - expect(t.numToChar(27)).toEqual("AA"); - expect(t.numToChar(52)).toEqual("AZ"); - expect(t.numToChar(78)).toEqual("BZ"); + buster.expect(t.numToChar(27)).toEqual("AA"); + buster.expect(t.numToChar(52)).toEqual("AZ"); + buster.expect(t.numToChar(78)).toEqual("BZ"); }); it("can convert triple letter numbers", function() { var t = new XlsxTemplate(); - expect(t.numToChar(703)).toEqual("AAA"); - expect(t.numToChar(728)).toEqual("AAZ"); - expect(t.numToChar(789)).toEqual("ADI"); + buster.expect(t.numToChar(703)).toEqual("AAA"); + buster.expect(t.numToChar(728)).toEqual("AAZ"); + buster.expect(t.numToChar(789)).toEqual("ADI"); }); }); @@ -373,39 +373,39 @@ describe("Helpers", function() { it("can check 1x1 cells", function() { var t = new XlsxTemplate(); - expect(t.isWithin("A1", "A1", "A1")).toEqual(true); - expect(t.isWithin("A2", "A1", "A1")).toEqual(false); - expect(t.isWithin("B1", "A1", "A1")).toEqual(false); + buster.expect(t.isWithin("A1", "A1", "A1")).toEqual(true); + buster.expect(t.isWithin("A2", "A1", "A1")).toEqual(false); + buster.expect(t.isWithin("B1", "A1", "A1")).toEqual(false); }); it("can check 1xn cells", function() { var t = new XlsxTemplate(); - expect(t.isWithin("A1", "A1", "A3")).toEqual(true); - expect(t.isWithin("A3", "A1", "A3")).toEqual(true); - expect(t.isWithin("A4", "A1", "A3")).toEqual(false); - expect(t.isWithin("A5", "A1", "A3")).toEqual(false); - expect(t.isWithin("B1", "A1", "A3")).toEqual(false); + buster.expect(t.isWithin("A1", "A1", "A3")).toEqual(true); + buster.expect(t.isWithin("A3", "A1", "A3")).toEqual(true); + buster.expect(t.isWithin("A4", "A1", "A3")).toEqual(false); + buster.expect(t.isWithin("A5", "A1", "A3")).toEqual(false); + buster.expect(t.isWithin("B1", "A1", "A3")).toEqual(false); }); it("can check nxn cells", function() { var t = new XlsxTemplate(); - expect(t.isWithin("A1", "A2", "C3")).toEqual(false); - expect(t.isWithin("A3", "A2", "C3")).toEqual(true); - expect(t.isWithin("B2", "A2", "C3")).toEqual(true); - expect(t.isWithin("A5", "A2", "C3")).toEqual(false); - expect(t.isWithin("D2", "A2", "C3")).toEqual(false); + buster.expect(t.isWithin("A1", "A2", "C3")).toEqual(false); + buster.expect(t.isWithin("A3", "A2", "C3")).toEqual(true); + buster.expect(t.isWithin("B2", "A2", "C3")).toEqual(true); + buster.expect(t.isWithin("A5", "A2", "C3")).toEqual(false); + buster.expect(t.isWithin("D2", "A2", "C3")).toEqual(false); }); it("can check large nxn cells", function() { var t = new XlsxTemplate(); - expect(t.isWithin("AZ1", "AZ2", "CZ3")).toEqual(false); - expect(t.isWithin("AZ3", "AZ2", "CZ3")).toEqual(true); - expect(t.isWithin("BZ2", "AZ2", "CZ3")).toEqual(true); - expect(t.isWithin("AZ5", "AZ2", "CZ3")).toEqual(false); - expect(t.isWithin("DZ2", "AZ2", "CZ3")).toEqual(false); + buster.expect(t.isWithin("AZ1", "AZ2", "CZ3")).toEqual(false); + buster.expect(t.isWithin("AZ3", "AZ2", "CZ3")).toEqual(true); + buster.expect(t.isWithin("BZ2", "AZ2", "CZ3")).toEqual(true); + buster.expect(t.isWithin("AZ5", "AZ2", "CZ3")).toEqual(false); + buster.expect(t.isWithin("DZ2", "AZ2", "CZ3")).toEqual(false); }); }); @@ -415,27 +415,27 @@ describe("Helpers", function() { it("can stringify dates", function() { var t = new XlsxTemplate(); - expect(t.stringify(new Date("2013-01-01"))).toEqual("2013-01-01T00:00:00.000Z"); + buster.expect(t.stringify(new Date("2013-01-01"))).toEqual("2013-01-01T00:00:00.000Z"); }); it("can stringify numbers", function() { var t = new XlsxTemplate(); - expect(t.stringify(12)).toEqual("12"); - expect(t.stringify(12.3)).toEqual("12.3"); + buster.expect(t.stringify(12)).toEqual("12"); + buster.expect(t.stringify(12.3)).toEqual("12.3"); }); it("can stringify booleans", function() { var t = new XlsxTemplate(); - expect(t.stringify(true)).toEqual("1"); - expect(t.stringify(false)).toEqual("0"); + buster.expect(t.stringify(true)).toEqual("1"); + buster.expect(t.stringify(false)).toEqual("0"); }); it("can stringify strings", function() { var t = new XlsxTemplate(); - expect(t.stringify("foo")).toEqual("foo"); + buster.expect(t.stringify("foo")).toEqual("foo"); }); }); @@ -464,10 +464,10 @@ describe("Helpers", function() { }; t.addSharedString(string); - expect(t.substituteScalar(col, string, placeholder, substitution)).toEqual("bar"); - expect(col.attrib.t).toEqual("s"); - expect(val.text).toEqual("0"); - expect(t.sharedStrings).toEqual(["bar"]); + buster.expect(t.substituteScalar(col, string, placeholder, substitution)).toEqual("bar"); + buster.expect(col.attrib.t).toEqual("s"); + buster.expect(String(val.text)).toEqual("0"); + buster.expect(t.sharedStrings).toEqual(["bar"]); }); it("can substitute simple numeric values", function() { @@ -492,10 +492,10 @@ describe("Helpers", function() { }; t.addSharedString(string); - expect(t.substituteScalar(col, string, placeholder, substitution)).toEqual("10"); - expect(col.attrib.t).toEqual("n"); - expect(val.text).toEqual("10"); - expect(t.sharedStrings).toEqual(["${foo}"]); + buster.expect(t.substituteScalar(col, string, placeholder, substitution)).toEqual("10"); + buster.expect(col.attrib.t).toEqual("n"); + buster.expect(val.text).toEqual("10"); + buster.expect(t.sharedStrings).toEqual(["${foo}"]); }); it("can substitute simple boolean values (false)", function() { @@ -520,10 +520,10 @@ describe("Helpers", function() { }; t.addSharedString(string); - expect(t.substituteScalar(col, string, placeholder, substitution)).toEqual("0"); - expect(col.attrib.t).toEqual("b"); - expect(val.text).toEqual("0"); - expect(t.sharedStrings).toEqual(["${foo}"]); + buster.expect(t.substituteScalar(col, string, placeholder, substitution)).toEqual("0"); + buster.expect(col.attrib.t).toEqual("b"); + buster.expect(val.text).toEqual("0"); + buster.expect(t.sharedStrings).toEqual(["${foo}"]); }); it("can substitute simple boolean values (true)", function() { @@ -548,10 +548,10 @@ describe("Helpers", function() { }; t.addSharedString(string); - expect(t.substituteScalar(col, string, placeholder, substitution)).toEqual("1"); - expect(col.attrib.t).toEqual("b"); - expect(val.text).toEqual("1"); - expect(t.sharedStrings).toEqual(["${foo}"]); + buster.expect(t.substituteScalar(col, string, placeholder, substitution)).toEqual("1"); + buster.expect(col.attrib.t).toEqual("b"); + buster.expect(val.text).toEqual("1"); + buster.expect(t.sharedStrings).toEqual(["${foo}"]); }); it("can substitute dates", function() { @@ -576,10 +576,10 @@ describe("Helpers", function() { }; t.addSharedString(string); - expect(t.substituteScalar(col, string, placeholder, substitution)).toEqual("2013-01-01T00:00:00.000Z"); - expect(col.attrib.t).toEqual("d"); - expect(val.text).toEqual("2013-01-01T00:00:00.000Z"); - expect(t.sharedStrings).toEqual(["${foo}"]); + buster.expect(t.substituteScalar(col, string, placeholder, substitution)).toEqual("2013-01-01T00:00:00.000Z"); + buster.expect(col.attrib.t).toEqual("d"); + buster.expect(val.text).toEqual("2013-01-01T00:00:00.000Z"); + buster.expect(t.sharedStrings).toEqual(["${foo}"]); }); it("can substitute parts of strings", function() { @@ -604,10 +604,10 @@ describe("Helpers", function() { }; t.addSharedString(string); - expect(t.substituteScalar(col, string, placeholder, substitution)).toEqual("foo: bar"); - expect(col.attrib.t).toEqual("s"); - expect(val.text).toEqual("0"); - expect(t.sharedStrings).toEqual(["foo: bar"]); + buster.expect(t.substituteScalar(col, string, placeholder, substitution)).toEqual("foo: bar"); + buster.expect(col.attrib.t).toEqual("s"); + buster.expect(val.text).toEqual("0"); + buster.expect(t.sharedStrings).toEqual(["foo: bar"]); }); it("can substitute parts of strings with booleans", function() { @@ -632,10 +632,10 @@ describe("Helpers", function() { }; t.addSharedString(string); - expect(t.substituteScalar(col, string, placeholder, substitution)).toEqual("foo: 0"); - expect(col.attrib.t).toEqual("s"); - expect(val.text).toEqual("0"); - expect(t.sharedStrings).toEqual(["foo: 0"]); + buster.expect(t.substituteScalar(col, string, placeholder, substitution)).toEqual("foo: 0"); + buster.expect(col.attrib.t).toEqual("s"); + buster.expect(val.text).toEqual("0"); + buster.expect(t.sharedStrings).toEqual(["foo: 0"]); }); it("can substitute parts of strings with numbers", function() { @@ -660,10 +660,10 @@ describe("Helpers", function() { }; t.addSharedString(string); - expect(t.substituteScalar(col, string, placeholder, substitution)).toEqual("foo: 10"); - expect(col.attrib.t).toEqual("s"); - expect(val.text).toEqual("0"); - expect(t.sharedStrings).toEqual(["foo: 10"]); + buster.expect(t.substituteScalar(col, string, placeholder, substitution)).toEqual("foo: 10"); + buster.expect(col.attrib.t).toEqual("s"); + buster.expect(val.text).toEqual("0"); + buster.expect(t.sharedStrings).toEqual(["foo: 10"]); });