feat(M08-A): 接入顾客端选店下单入口
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import { readFileSync } from 'node:fs';
|
||||
import { join } from 'node:path';
|
||||
|
||||
const root = new URL('..', import.meta.url).pathname.replace(/^\/([A-Za-z]:)/, '$1');
|
||||
const read = (path) => readFileSync(join(root, path), 'utf8');
|
||||
|
||||
const appJson = JSON.parse(read('miniapp/app.json'));
|
||||
for (const page of [
|
||||
'pages/index/index',
|
||||
'pages/store/detail',
|
||||
'pages/room/detail'
|
||||
]) {
|
||||
assert.ok(appJson.pages.includes(page), `${page} must be registered`);
|
||||
}
|
||||
|
||||
const env = read('miniapp/config/env.js');
|
||||
assert.match(env, /https:\/\/api\.txyundm\.cn/);
|
||||
assert.doesNotMatch(env, /localhost|127\.0\.0\.1|http:\/\//);
|
||||
|
||||
const api = read('miniapp/utils/api.js');
|
||||
assert.match(api, /\/auth\/wechat-login/);
|
||||
assert.match(api, /authorization: `Bearer \$\{token\}`/);
|
||||
|
||||
const index = read('miniapp/pages/index/index.js');
|
||||
assert.match(index, /\/stores\?\$\{query\}/);
|
||||
assert.match(index, /openStore/);
|
||||
|
||||
const store = read('miniapp/pages/store/detail.js');
|
||||
assert.match(store, /\/stores\/\$\{encodeURIComponent\(storeId\)\}/);
|
||||
assert.match(store, /\/stores\/\$\{encodeURIComponent\(storeId\)\}\/rooms/);
|
||||
assert.match(store, /\/stores\/\$\{encodeURIComponent\(this\.data\.storeId\)\}\/wifi/);
|
||||
|
||||
const room = read('miniapp/pages/room/detail.js');
|
||||
for (const route of [
|
||||
'/pricing/quote',
|
||||
'/orders/reserve',
|
||||
'/payments',
|
||||
'/test-complete'
|
||||
]) {
|
||||
assert.match(room, new RegExp(route.replace('/', '\\/')));
|
||||
}
|
||||
|
||||
console.log('PASS: M08-A miniapp customer pages use fixed domain and real app-api calls.');
|
||||
Reference in New Issue
Block a user