From b69111fb7e60170358215216e432d421391bfc4d Mon Sep 17 00:00:00 2001 From: Willy Brauner Date: Wed, 18 Oct 2023 15:41:23 +0200 Subject: [PATCH] fix test --- examples/example-client/src/pages/YoloPage.tsx | 7 ++++++- examples/example-client/src/routes.ts | 5 +++++ package.json | 2 +- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/examples/example-client/src/pages/YoloPage.tsx b/examples/example-client/src/pages/YoloPage.tsx index 2be5c07d..71afccad 100644 --- a/examples/example-client/src/pages/YoloPage.tsx +++ b/examples/example-client/src/pages/YoloPage.tsx @@ -3,7 +3,11 @@ import { useLocation, useStack } from "@cher-ami/router"; import { transitionsHelper } from "../helper/transitionsHelper"; const componentName: string = "YoloPage"; -interface IProps {} +interface IProps { + time: { + datetime: string; + }; +} const YoloPage = forwardRef((props: IProps, handleRef: ForwardedRef) => { const rootRef = useRef(null); @@ -21,6 +25,7 @@ const YoloPage = forwardRef((props: IProps, handleRef: ForwardedRef) => { return (
{componentName} +
fetch props datetime: {props.time?.datetime}


diff --git a/examples/example-client/src/routes.ts b/examples/example-client/src/routes.ts index a011950b..27c7d33a 100644 --- a/examples/example-client/src/routes.ts +++ b/examples/example-client/src/routes.ts @@ -30,6 +30,11 @@ export const routesList: TRoute[] = [ { path: "/yolo", component: YoloPage, + getStaticProps: async (props, currentLang) => { + const res = await fetch("https://worldtimeapi.org/api/ip"); + const time = await res.json(); + return { time }; + }, }, { path: "/hello", diff --git a/package.json b/package.json index 8c34ce2c..3648c8f2 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,7 @@ "build:example-ssr": "pnpm --filter ./examples/example-ssr run build", "size": "size-limit", "size-why": "size-limit -- --why", - "test": "jest && npm run size", + "test": "jest", "test:watch": "jest --watch", "pre-publish": "npm run build && npm run test" },