Skip to content

Commit 0300046

Browse files
committed
#39: Fixed tests that were using "plain: true"
* Using "plain: true" was giving a single object when expecting an array. * Now, we are using row.toJSON() instead, on each individual returned rows. Signed-off-by: Jillian Daguil <[email protected]>
1 parent be436ef commit 0300046

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

test/aboutCodeDB.test.js

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@ describe("checkAboutCodeDB", function() {
4343

4444
return aboutCodeDB.db
4545
.then(() => aboutCodeDB.addRows(scanCodeJSONResults))
46-
.then(() => aboutCodeDB.findAll({ plain: true }))
46+
.then(() => aboutCodeDB.findAll({}))
4747
.then((rows) => {
48-
rows = JSON.parse(JSON.stringify(rows));
49-
assert.containSubset(rows, scanCodeJSONResults.files[0])
48+
rows = rows.map(row => row.toJSON());
49+
assert.containSubset(rows, scanCodeJSONResults.files);
5050
})
5151
});
5252
});
@@ -58,12 +58,11 @@ describe("checkAboutCodeDB", function() {
5858
return aboutCodeDB.db
5959
.then(() => aboutCodeDB.addRows(scanCodeJSONResults))
6060
.then(() => aboutCodeDB.findOne({
61-
where: { path: "samples/JGroups/src"},
62-
plain: true
61+
where: { path: "samples/JGroups/src"}
6362
}))
64-
.then((rows) => {
65-
rows = JSON.parse(JSON.stringify(rows));
66-
assert.containSubset(rows, scanCodeJSONResults.files[1])
63+
.then((row) => {
64+
row = row.toJSON();
65+
assert.containSubset(row, scanCodeJSONResults.files[1]);
6766
})
6867
});
6968
});

0 commit comments

Comments
 (0)