合入主线登录和营业时段策略,对齐旧界面与 React 访问流程
This commit is contained in:
commit
42395de23a
113 files changed
+1915
-558
No files matched your search
@@ -423,3 +423,31 @@ test('账号下拉按固定成员登录,密码仍必校验,停用或未知
|
||||
!(await f.call('/api/session', undefined, 'none')).body.loginOptions.some(row => row.member === 'assistant'),
|
||||
);
|
||||
});
|
||||
|
||||
test('店主可配置和清除每日营业时段,员工无权修改,旧客户端保存其他字段保留时段', async t => {
|
||||
const f = await fixture(t);
|
||||
const route = '/api/shop-settings',
|
||||
hours = { open: '20:30', close: '02:00' };
|
||||
assert.equal((await f.call(route)).body.businessHours, null);
|
||||
assert.equal((await f.call(route, { revision: 0, businessHours: hours }, 'assistant')).status, 403);
|
||||
for (const invalid of [{ open: '08:00' }, { open: '24:00', close: '18:00' }, { open: '09:00', close: '09:00' }]) {
|
||||
assert.equal((await f.call(route, { revision: 0, businessHours: invalid })).status, 400);
|
||||
}
|
||||
assert.deepEqual((await f.call(route, { revision: 0, businessHours: hours })).body.shopSettings.businessHours, hours);
|
||||
assert.deepEqual((await f.call(route, { revision: 1, contact: '测试门店' })).body.shopSettings.businessHours, hours);
|
||||
assert.equal((await f.call(route, { revision: 1, businessHours: null })).status, 409);
|
||||
const staff = await f.call(route, undefined, 'assistant');
|
||||
assert.equal(staff.status, 200);
|
||||
assert.equal(Object.hasOwn(staff.body, 'businessHours'), false);
|
||||
assert.equal((await f.call(route, { revision: 2, businessHours: null })).body.shopSettings.businessHours, null);
|
||||
assert.equal(f.ledger.meta(Settings.KEY).businessHours, null);
|
||||
const changes = f.ledger
|
||||
.rows("SELECT detail FROM audit WHERE entity='shop-settings' ORDER BY id")
|
||||
.map(({ detail }) => JSON.parse(detail))
|
||||
.map(({ before, after }) => [before.businessHours, after.businessHours]);
|
||||
assert.deepEqual(changes, [
|
||||
[null, hours],
|
||||
[hours, hours],
|
||||
[hours, null],
|
||||
]);
|
||||
});
|
||||
Reference in new issue
Block a user