Test bug hunting in CI

master
Mark Moffat 2019-11-09 15:48:13 +10:30
parent 9c0d22af1d
commit 1bcd897d22
2 changed files with 9 additions and 16 deletions

View File

@ -7,7 +7,7 @@
"start": "node app.js", "start": "node app.js",
"deploy": "gulp deploy", "deploy": "gulp deploy",
"testdata": "node lib/testdata.js", "testdata": "node lib/testdata.js",
"test": "NODE_ENV=test ava --verbose", "test": "ava",
"dev": "nodemon app.js", "dev": "nodemon app.js",
"lint": "eslint ./" "lint": "eslint ./"
}, },
@ -15,7 +15,11 @@
"serial": true, "serial": true,
"files": [ "files": [
"./test/specs/*.js" "./test/specs/*.js"
] ],
"verbose": true,
"environmentVariables": {
"NODE_ENV": "test"
}
}, },
"engines": { "engines": {
"node": "10.16.0" "node": "10.16.0"

View File

@ -51,6 +51,9 @@ const runBefore = async () => {
// Get some data from DB to use in compares // Get some data from DB to use in compares
g.products = await g.db.products.find({}).toArray(); g.products = await g.db.products.find({}).toArray();
g.customers = await g.db.customers.find({}).toArray(); g.customers = await g.db.customers.find({}).toArray();
g.users = await g.db.users.find({}).toArray();
console.log('Users', g.users);
// Insert orders using product ID's // Insert orders using product ID's
_(jsonData.orders).each(async (order) => { _(jsonData.orders).each(async (order) => {
@ -69,20 +72,6 @@ const runBefore = async () => {
await g.db.orders.insertOne(order); await g.db.orders.insertOne(order);
}); });
// Add API keys for users
_(jsonData.users).each(async (user) => {
await g.db.users.updateOne({
_id: getId(user._id)
}, {
$set: {
apiKey: newId()
}
});
});
// Get the updated users
g.users = await g.db.users.find({}).toArray();
// Index everything // Index everything
await runIndexing(app); await runIndexing(app);