Skip to content

Commit

Permalink
Fix test and add new test
Browse files Browse the repository at this point in the history
  • Loading branch information
fgervasi committed Nov 19, 2021
1 parent b90c6ef commit 769bfba
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 2 deletions.
51 changes: 51 additions & 0 deletions resources/fixtures/data/one-column.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"title": "FIXTURE: simple one-column short table with numeric values",
"subtitle": "some subtitle here",
"data": {
"table": [
[
"Punkte"
],
[
"10000000"
],
[
"20000000"
],
[
"355547.5"
],
[
"-3500000"
]
],
"metaData": {
"cells": []
}
},
"options": {
"cardLayout": false,
"cardLayoutIfSmall": false,
"minibar": {
"invertColors": false,
"barColor": {
"positive": {
"className": "",
"colorCode": ""
},
"negative": {
"className": "",
"colorCode": ""
}
},
"selectedColumn": null
}
},
"notes": "Anmerkungen",
"sources": [
{
"link": {},
"text": "Bloomberg"
}
]
}
28 changes: 26 additions & 2 deletions test/e2e-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ lab.experiment("option availability endpoint", () => {
expect(response.result.available).to.be.equal(true);
});

it("returns false for option availability of minibar selectedColumn", async () => {
it("returns true for option availability of minibar selectedColumn", async () => {
const request = {
method: "POST",
url: "/option-availability/selectedColumnMinibar",
Expand All @@ -138,6 +138,18 @@ lab.experiment("option availability endpoint", () => {
},
};
const response = await server.inject(request);
expect(response.result.available).to.be.equal(true);
});

it("Minibar is not available from a certain number of columns", async () => {
const request = {
method: "POST",
url: "/option-availability/selectedColumnMinibar",
payload: {
item: require("../resources/fixtures/data/one-column.json"),
},
};
const response = await server.inject(request);
expect(response.result.available).to.be.equal(false);
});

Expand All @@ -153,7 +165,7 @@ lab.experiment("option availability endpoint", () => {
expect(response.result.available).to.be.equal(true);
});

it("returns false for option availability of colorColumn selectedColumn", async () => {
it("returns true for option availability of colorColumn selectedColumn", async () => {
const request = {
method: "POST",
url: "/option-availability/selectedColorColumn",
Expand All @@ -162,6 +174,18 @@ lab.experiment("option availability endpoint", () => {
},
};
const response = await server.inject(request);
expect(response.result.available).to.be.equal(true);
});

it("ColorColumn is not available from a certain number of columns", async () => {
const request = {
method: "POST",
url: "/option-availability/selectedColorColumn",
payload: {
item: require("../resources/fixtures/data/one-column.json"),
},
};
const response = await server.inject(request);
expect(response.result.available).to.be.equal(false);
});
});
Expand Down

0 comments on commit 769bfba

Please sign in to comment.