import { IApp } from '@cloudbase/cals';

export const componentError: IApp = {
  name: 'test_app',
  description: '找不到组件',
  main: 'index',
  items: [
    {
      type: 'PAGE',
      id: 'index',
      component: 'page',
      items: [
        {
          id: '1',
          component: 'Text2',
          module: 'gsd-h5-react',
          attributes: {
            text: '组件库正常，组件找不到',
          },
        },
      ],
    },
  ],
};

export const componentLibError: IApp = {
  name: 'test_app',
  description: '找不到组件',
  main: 'index',
  items: [
    {
      type: 'PAGE',
      id: 'index',
      component: 'page',
      items: [
        {
          id: '1',
          component: 'Text',
          module: 'xxxxx',
          attributes: {
            text: '组件库找不到',
          },
        },
      ],
    },
  ],
};

export const lifecycleError: IApp = {
  name: 'test_app',
  description: '生命周期代码异常',
  main: 'index',
  items: [
    {
      type: 'PAGE',
      id: 'index',
      component: 'page',
      items: [
        {
          id: '1',
          component: 'Text',
          module: 'gsd-h5-react',
          attributes: {
            text: '生命周期代码异常',
          },
        },
      ],
      resources: [
        {
          name: 'lifecycle',
          type: 'CODE',
          codeType: 'lifecycle',
          path: 'index/lifecycle',
          code: `
export default {
  onPageLoad(){
    console.debug('-- will throw error --')
    throw new Error('test error')
  }
}
    `,
        },
      ],
    },
  ],
};
