补齐固定旧版的浏览器逐笔写入对照并记录账务差异
This commit is contained in:
1 parent
e77588b337
commit
7d2007955f
39 files changed
+3653
-41
No files matched your search
@@ -0,0 +1,57 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import { write } from './ui.mjs';
|
||||
export default async function history(ctx) {
|
||||
const { session, day } = ctx,
|
||||
owner = await ctx.pageFor('owner');
|
||||
const { user } = await session.get('owner', '/api/state');
|
||||
const daily = await session.get('owner', '/api/daily-funds?date=' + day);
|
||||
const cases = [
|
||||
['旧人数登记', '/api/people-count', { date: day, count: 12, assistant1Count: 5, assistant2Count: 3, revision: 0 }],
|
||||
[
|
||||
'历史服务端销售草稿',
|
||||
'/api/orders',
|
||||
{
|
||||
date: day,
|
||||
customer: '历史草稿',
|
||||
internal_note: '临时账本',
|
||||
salesperson: '麦麦',
|
||||
payment_account: '麦麦现金',
|
||||
lines: [
|
||||
{ name: '足金手镯', unit: 'g', quantity: '1', pocket: '现货', payer: 'owner', sale: '980', cost: '900' },
|
||||
],
|
||||
fee_items: [],
|
||||
},
|
||||
],
|
||||
[
|
||||
'旧完整对外支出确认',
|
||||
'/api/daily-funds/confirm',
|
||||
{
|
||||
date: day,
|
||||
amount: '27.30',
|
||||
revision: daily.confirmation?.revision ?? 0,
|
||||
sourceRevision: daily.sources.revision,
|
||||
verified: true,
|
||||
},
|
||||
],
|
||||
];
|
||||
for (const [i, [label, url, data]] of cases.entries()) {
|
||||
const job = { url, data, userId: user.id, key: 'legacy-browser-parity-' + i };
|
||||
await owner.evaluate(job => localStorage.setItem('mm-pending-' + job.userId, JSON.stringify(job)), job);
|
||||
await owner.goto(ctx.base + (ctx.version === 'old' ? '/' : '/next/orders'));
|
||||
const button = owner.getByRole('button', { name: '恢复原操作', exact: true }).first();
|
||||
const result = await write(
|
||||
ctx,
|
||||
owner,
|
||||
'历史待确认操作 ' + label,
|
||||
url,
|
||||
() => button.click(),
|
||||
url === '/api/daily-funds/confirm' ? 409 : 200,
|
||||
);
|
||||
if (url === '/api/daily-funds/confirm') {
|
||||
assert.match(result.error, /三人经营款按成员往来核对/);
|
||||
continue;
|
||||
}
|
||||
assert.ok(result);
|
||||
assert.equal(await owner.evaluate(id => localStorage.getItem('mm-pending-' + id), user.id), null);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user