63 lines
1.8 KiB
JavaScript
63 lines
1.8 KiB
JavaScript
const assert = require('assert');
|
|
const CeremonyPages = require('../public/js/ceremony-pages.js');
|
|
|
|
function run() {
|
|
assert.deepStrictEqual(CeremonyPages.normalizeList({ rows: [{ ceremonyId: 1 }] }), [{ ceremonyId: 1 }]);
|
|
assert.deepStrictEqual(CeremonyPages.normalizeList({ records: [{ ceremonyId: 2 }] }), [{ ceremonyId: 2 }]);
|
|
|
|
assert.deepStrictEqual(CeremonyPages.buildCeremonyBody({
|
|
ceremonyType: ' wedding ',
|
|
ceremonyTitle: ' 婚礼邀请 ',
|
|
ceremonyDesc: ' 邀请亲友 ',
|
|
ceremonyTime: '2026-07-09 10:00:00',
|
|
location: ' 祠堂 ',
|
|
coverOssId: '',
|
|
sortOrder: '',
|
|
status: ''
|
|
}), {
|
|
ceremonyType: 'wedding',
|
|
ceremonyTitle: '婚礼邀请',
|
|
ceremonyDesc: '邀请亲友',
|
|
ceremonyTime: '2026-07-09 10:00:00',
|
|
location: '祠堂',
|
|
coverOssId: undefined,
|
|
sortOrder: 1,
|
|
status: '0'
|
|
});
|
|
|
|
assert.deepStrictEqual(CeremonyPages.buildMeritBody({
|
|
donorName: ' 汤明 ',
|
|
meritType: '',
|
|
meritTitle: ' 修谱捐款 ',
|
|
meritContent: ' 支持修谱 ',
|
|
amount: ' 100 ',
|
|
meritTime: '',
|
|
sortOrder: '',
|
|
status: ''
|
|
}), {
|
|
donorName: '汤明',
|
|
meritType: 'donation',
|
|
meritTitle: '修谱捐款',
|
|
meritContent: '支持修谱',
|
|
amount: 100,
|
|
meritTime: undefined,
|
|
sortOrder: 1,
|
|
status: '0'
|
|
});
|
|
|
|
assert.strictEqual(
|
|
CeremonyPages.buildCeremonyRow({
|
|
ceremonyId: 601,
|
|
ceremonyTitle: '婚礼邀请',
|
|
ceremonyType: 'wedding',
|
|
ceremonyTime: '2026-07-09',
|
|
giftCount: 2
|
|
}, '900001001'),
|
|
'<button class="module-row ceremony-row" type="button" data-ceremony-id="601"><div><h3>婚礼邀请</h3><p>wedding · 2026-07-09 · 2 条献礼</p></div><span class="pill">管理</span></button>'
|
|
);
|
|
|
|
console.log('ceremony-pages tests passed');
|
|
}
|
|
|
|
run();
|