tests: add basic integration tests (#13)
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
# fresh project
|
||||
|
||||
### Usage
|
||||
|
||||
Install deployctl:
|
||||
|
||||
```
|
||||
deno install --allow-read --allow-write --allow-env --allow-net --allow-run --no-check -r -f https://deno.land/x/deploy/deployctl.ts
|
||||
```
|
||||
|
||||
Start the project:
|
||||
|
||||
```
|
||||
deployctl run --no-check --watch main.ts
|
||||
```
|
||||
|
||||
After adding, removing, or moving a page in the `pages` directory, run:
|
||||
|
||||
```
|
||||
fresh routes
|
||||
```
|
||||
@@ -0,0 +1 @@
|
||||
export * from "../../server.ts";
|
||||
@@ -0,0 +1 @@
|
||||
export * from "../../runtime.ts";
|
||||
@@ -0,0 +1,4 @@
|
||||
import { start } from "../../server.ts";
|
||||
import routes from "./routes.gen.ts";
|
||||
|
||||
start(routes);
|
||||
@@ -0,0 +1,9 @@
|
||||
import { h } from "../deps.ts";
|
||||
|
||||
interface Props {
|
||||
params: Record<string, string | string[]>;
|
||||
}
|
||||
|
||||
export default function Greet(props: Props) {
|
||||
return <div>Hello {props.params.name}</div>;
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
import { oak } from "../../api_deps.ts";
|
||||
|
||||
export default (ctx: oak.Context) => {
|
||||
ctx.response.body = { name: "fresh" };
|
||||
};
|
||||
@@ -0,0 +1,9 @@
|
||||
import { h, IS_BROWSER, useState } from "../deps.ts";
|
||||
|
||||
export default function Home() {
|
||||
return (
|
||||
<div>
|
||||
<p>{IS_BROWSER ? "Viewing browser render." : "Viewing JIT render."}</p>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
// DO NOT EDIT. This file is generated by `fresh`.
|
||||
// This file SHOULD be checked into source version control.
|
||||
// To update this file, run `fresh routes`.
|
||||
|
||||
import * as $0 from "./pages/api/name.ts";
|
||||
import * as $1 from "./pages/[name].tsx";
|
||||
import * as $2 from "./pages/index.tsx";
|
||||
|
||||
const routes = {
|
||||
pages: {
|
||||
"./pages/api/name.ts": $0,
|
||||
"./pages/[name].tsx": $1,
|
||||
"./pages/index.tsx": $2,
|
||||
},
|
||||
baseUrl: import.meta.url,
|
||||
};
|
||||
|
||||
export default routes;
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"jsxFactory": "h",
|
||||
"jsxFragmentFactory": "Fragment"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user