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> {
|
async function getPageConfig(routeId: string, configEntry: string): Promise<MixedPage> {
|
||||||
const routesConfig = (await import(configEntry)).default;
|
const routesConfig = (await import(configEntry)).default;
|
||||||
const routeConfig = routesConfig![`/${routeId}`]?.() as MixedPage;
|
const routeConfig = routesConfig![`/${routeId}`]?.() as MixedPage || {};
|
||||||
const filteredConfig = {};
|
const filteredConfig = {};
|
||||||
Object.keys(routeConfig).forEach((key) => {
|
Object.keys(routeConfig).forEach((key) => {
|
||||||
if (validPageConfigKeys.includes(key)) {
|
if (validPageConfigKeys.includes(key)) {
|
||||||
|
|
|
||||||
|
|
@ -415,7 +415,6 @@ describe('parse manifest', () => {
|
||||||
...options,
|
...options,
|
||||||
urlPrefix: '{{xxx}}/',
|
urlPrefix: '{{xxx}}/',
|
||||||
});
|
});
|
||||||
console.log('manifest', manifest);
|
|
||||||
expect(manifest.tab_bar?.url).toBe('{{xxx}}/tabBar');
|
expect(manifest.tab_bar?.url).toBe('{{xxx}}/tabBar');
|
||||||
expect(manifest.tab_bar?.name).toBe('{{xxx}}');
|
expect(manifest.tab_bar?.name).toBe('{{xxx}}');
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,15 @@
|
||||||
const configData = {
|
const configData = {
|
||||||
home: {
|
'/home': {
|
||||||
priority: 'low',
|
priority: 'low',
|
||||||
dataPrefetch: {
|
dataPrefetch: {
|
||||||
api: 'test/api',
|
api: 'test/api',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
about: {
|
'/about': {
|
||||||
defaultFrameIndex: 0,
|
defaultFrameIndex: 0,
|
||||||
queryParams: 'c=123',
|
queryParams: 'c=123',
|
||||||
},
|
},
|
||||||
'app/nest': {
|
'/app/nest': {
|
||||||
frames: [
|
frames: [
|
||||||
'home',
|
'home',
|
||||||
{
|
{
|
||||||
|
|
@ -23,7 +23,7 @@ const config = new Proxy(configData, {
|
||||||
get: function(obj, props) {
|
get: function(obj, props) {
|
||||||
if (props in obj) {
|
if (props in obj) {
|
||||||
const defaultConfig = {
|
const defaultConfig = {
|
||||||
title: `title-${props}`,
|
title: `title-${props.replace(/^\//, '')}`,
|
||||||
};
|
};
|
||||||
return () => ({
|
return () => ({
|
||||||
...defaultConfig,
|
...defaultConfig,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue