diff --git a/package.json b/package.json index 3424154..88bf2b9 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "start": "node app.js", "deploy": "gulp deploy", "testdata": "node lib/testdata.js", - "test": "NODE_ENV=test ava --verbose", + "test": "ava", "dev": "nodemon app.js", "lint": "eslint ./" }, @@ -15,7 +15,11 @@ "serial": true, "files": [ "./test/specs/*.js" - ] + ], + "verbose": true, + "environmentVariables": { + "NODE_ENV": "test" + } }, "engines": { "node": "10.16.0" diff --git a/test/helper.js b/test/helper.js index 5460707..c070901 100644 --- a/test/helper.js +++ b/test/helper.js @@ -51,6 +51,9 @@ const runBefore = async () => { // Get some data from DB to use in compares g.products = await g.db.products.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 _(jsonData.orders).each(async (order) => { @@ -69,20 +72,6 @@ const runBefore = async () => { 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 await runIndexing(app);