Added test for order filtering

master
Mark Moffat 2019-06-15 21:00:04 +09:30
parent 53c5221dae
commit 0871de9802
1 changed files with 13 additions and 1 deletions

View File

@ -45,7 +45,6 @@ test.before(async () => {
db = app.db;
await setup(db);
await runIndexing(app);
// Get some data from DB to use in compares
products = await db.products.find({}).toArray();
@ -69,6 +68,9 @@ test.before(async () => {
await db.orders.insert(order);
});
// Index everything
await runIndexing(app);
resolve();
});
});
@ -271,6 +273,16 @@ test.serial('[Success] Get orders by <Paid> status', async t => {
t.deepEqual(1, res.body.orders.length);
});
test.serial('[Success] Filter orders', async t => {
const res = await request
.get('/admin/orders/filter/Cles')
.set('apiKey', users[0].apiKey)
.expect(200);
// Check the returned order length
t.deepEqual(2, res.body.orders.length);
});
test.serial('[Fail] Try create a duplicate customer', async t => {
const customer = {
email: 'sarah.jones@test.com',