44 lines
1.1 KiB
JavaScript
44 lines
1.1 KiB
JavaScript
'use strict';
|
|
|
|
const assert = require('node:assert/strict');
|
|
const Sequelize = require('sequelize');
|
|
const OrderBaseService = require('../../../../app/service/systemMethods/order/base');
|
|
|
|
describe('test/app/service/systemMethods/order.base.step.test.js', () => {
|
|
function createService() {
|
|
const ctx = {
|
|
app: {
|
|
Sequelize,
|
|
config: {},
|
|
},
|
|
user: {},
|
|
};
|
|
|
|
return new OrderBaseService(ctx);
|
|
}
|
|
|
|
it('should build where with step equality filter', () => {
|
|
const service = createService();
|
|
const where = service.buildWhere({ step: 1 }, 100000);
|
|
|
|
assert.equal(where.warehouse_id, 100000);
|
|
assert.equal(where.step, 1);
|
|
assert.equal(Object.prototype.hasOwnProperty.call(where, 'audit_status'), false);
|
|
});
|
|
|
|
it('should build where with step in filter', () => {
|
|
const service = createService();
|
|
const where = service.buildWhere({
|
|
step: {
|
|
operator: 'in',
|
|
value: [ 0, 1, 2 ],
|
|
},
|
|
}, 100000);
|
|
|
|
assert.equal(where.warehouse_id, 100000);
|
|
assert.deepEqual(where.step, {
|
|
[Sequelize.Op.in]: [ 0, 1, 2 ],
|
|
});
|
|
});
|
|
});
|