Added test for order filtering
parent
53c5221dae
commit
0871de9802
14
test/test.js
14
test/test.js
|
@ -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',
|
||||
|
|
Loading…
Reference in New Issue