Skip to content

Commit

Permalink
added more test
Browse files Browse the repository at this point in the history
  • Loading branch information
lmfresneda committed Aug 10, 2017
1 parent 06f7c0f commit 29f28d0
Showing 1 changed file with 29 additions and 7 deletions.
36 changes: 29 additions & 7 deletions test/utils.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,21 @@ describe("Utils", function() {
}, 2000);
});

it("# getLogFiltered() with array null", function() {
var log = Utils.getLogFiltered(null);
expect(log).not.to.be.ok();
});

it("# getLogFiltered() with empty array", function() {
var log = Utils.getLogFiltered([]);
expect(log).to.have.length(0);
});

it("# getLogFiltered() with query null", function() {
var log = Utils.getLogFiltered([{}], null);
expect(log).to.have.length(1);
});

it("# getUnixDate()", function() {
const now = Date.now();
expect(Utils.getUnixDate(now)).to.be.equal(now);
Expand All @@ -65,17 +80,15 @@ describe("Utils", function() {
});

it("# buildCsvContent()", function() {
});

const arr = [
{ field1: 'value1', field2: 'value2' },
{ field1: 'value11', field2: 'value22' }
];
it("# buildCsvContent() with empty array", function() {

const arr = [];

const csv = Utils.buildCsvContent(arr);

expect(csv).to.be.equal(
'field1;field2\nvalue1;value2\nvalue11;value22\n'
);
expect(csv).to.be.equal('');
});

it("# buildTxtContent()", function() {
Expand All @@ -91,4 +104,13 @@ describe("Utils", function() {
'field1\tfield2\nvalue1\tvalue2\nvalue11\tvalue22\n'
);
});

it("# buildTxtContent() with empty array", function() {

const arr = [];

const txt = Utils.buildTxtContent(arr);

expect(txt).to.be.equal('');
});
});

0 comments on commit 29f28d0

Please sign in to comment.