统一三端桥接层职责命名
微信小程序 host-bridge 与 shell 文件改为职责命名 移动壳 host-bridge 与 shell 文件改为职责命名 更新原生壳结构门禁、微信 smoke 和宿主壳文档
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
import path from 'node:path';
|
||||
|
||||
import { beforeEach, describe, expect, test, vi } from 'vitest';
|
||||
|
||||
import { loadCommonJsModule } from '../test-utils/loadCommonJsModule.js';
|
||||
|
||||
const shareGridBridgePath = path.resolve(
|
||||
process.cwd(),
|
||||
'miniprogram/host-bridge/shareGrid.js',
|
||||
);
|
||||
const shareGridShellPath = path.resolve(
|
||||
process.cwd(),
|
||||
'miniprogram/shell/shareGrid.js',
|
||||
);
|
||||
|
||||
let createWechatShareGridPage;
|
||||
|
||||
function createPage() {
|
||||
const page = createWechatShareGridPage();
|
||||
return {
|
||||
...page,
|
||||
data: { ...page.data },
|
||||
setData(patch) {
|
||||
Object.assign(this.data, patch);
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
describe('wechat share-grid shell page', () => {
|
||||
beforeEach(() => {
|
||||
globalThis.wx = {
|
||||
navigateBack: vi.fn(),
|
||||
};
|
||||
const shareGridBridge = loadCommonJsModule(shareGridBridgePath);
|
||||
const shareGridShell = loadCommonJsModule(shareGridShellPath, {
|
||||
'../host-bridge/shareGrid': shareGridBridge,
|
||||
});
|
||||
createWechatShareGridPage = shareGridShell.createWechatShareGridPage;
|
||||
});
|
||||
|
||||
test('shows a clear error when imageUrl is missing', async () => {
|
||||
const page = createPage();
|
||||
|
||||
await page.onLoad({});
|
||||
|
||||
expect(page.data.loading).toBe(false);
|
||||
expect(page.data.errorMessage).toBe('缺少封面图。');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user