ice/packages/plugin-pha/tests/mockConfig.mjs

38 lines
615 B
JavaScript
Raw Normal View History

2022-06-17 17:54:15 +08:00
const configData = {
home: {
priority: 'low',
2022-06-23 17:26:33 +08:00
dataPrefetch: {
api: 'test/api',
},
2022-06-17 17:54:15 +08:00
},
about: {
defaultFrameIndex: 0,
2022-06-23 17:26:33 +08:00
queryParams: 'c=123',
2022-06-17 17:54:15 +08:00
},
'app/nest': {
frames: [
2022-06-20 16:16:35 +08:00
'home',
2022-06-17 17:54:15 +08:00
{
url: 'https://m.taobao.com',
},
],
},
}
const config = new Proxy(configData, {
get: function(obj, props) {
if (props in obj) {
const defaultConfig = {
title: `title-${props}`,
};
2022-06-23 17:26:33 +08:00
return () => ({
2022-06-17 17:54:15 +08:00
...defaultConfig,
...(obj[props] || {}),
2022-06-23 17:26:33 +08:00
});
2022-06-17 17:54:15 +08:00
} else {
return undefined;
}
}
})
export default config;