ray-template/__test__/utils/setupMiniApp.ts
2024-03-24 15:31:06 +08:00

28 lines
565 B
TypeScript

import { setupStore } from '../../src/store'
import { setupRouter } from '../../src/router'
import { setupI18n } from '../../src/locales'
import renderHook from '../utils/renderHook'
/**
*
* @description
* 初始化 mini ray template 应用环境。
* 该方法会初始化 store、router、i18n 等环境。
*
* @example
* const { app } = await setupMiniApp()
*/
const setupMiniApp = async () => {
const [_, app] = renderHook(() => {})
setupStore(app)
setupRouter(app)
await setupI18n(app)
return {
app,
}
}
export default setupMiniApp