mirror of https://github.com/alibaba/ice.git
chore: optimize test case
This commit is contained in:
parent
575920592e
commit
3e62eddfa0
|
|
@ -95,7 +95,7 @@ function getPageUrl(routeId: string, options: ParseOptions) {
|
|||
|
||||
async function getPageConfig(routeId: string, configEntry: string): Promise<MixedPage> {
|
||||
const routesConfig = (await import(configEntry)).default;
|
||||
const routeConfig = routesConfig![`/${routeId}`]?.() as MixedPage;
|
||||
const routeConfig = routesConfig![`/${routeId}`]?.() as MixedPage || {};
|
||||
const filteredConfig = {};
|
||||
Object.keys(routeConfig).forEach((key) => {
|
||||
if (validPageConfigKeys.includes(key)) {
|
||||
|
|
|
|||
|
|
@ -415,7 +415,6 @@ describe('parse manifest', () => {
|
|||
...options,
|
||||
urlPrefix: '{{xxx}}/',
|
||||
});
|
||||
console.log('manifest', manifest);
|
||||
expect(manifest.tab_bar?.url).toBe('{{xxx}}/tabBar');
|
||||
expect(manifest.tab_bar?.name).toBe('{{xxx}}');
|
||||
})
|
||||
|
|
|
|||
|
|
@ -1,15 +1,15 @@
|
|||
const configData = {
|
||||
home: {
|
||||
'/home': {
|
||||
priority: 'low',
|
||||
dataPrefetch: {
|
||||
api: 'test/api',
|
||||
},
|
||||
},
|
||||
about: {
|
||||
'/about': {
|
||||
defaultFrameIndex: 0,
|
||||
queryParams: 'c=123',
|
||||
},
|
||||
'app/nest': {
|
||||
'/app/nest': {
|
||||
frames: [
|
||||
'home',
|
||||
{
|
||||
|
|
@ -23,7 +23,7 @@ const config = new Proxy(configData, {
|
|||
get: function(obj, props) {
|
||||
if (props in obj) {
|
||||
const defaultConfig = {
|
||||
title: `title-${props}`,
|
||||
title: `title-${props.replace(/^\//, '')}`,
|
||||
};
|
||||
return () => ({
|
||||
...defaultConfig,
|
||||
|
|
|
|||
Loading…
Reference in New Issue