tests: add basic integration tests (#13)

This commit is contained in:
Luca Casonato
2021-06-02 01:16:31 +02:00
committed by GitHub
parent cfe2584669
commit 26189cfdf3
13 changed files with 137 additions and 3 deletions
+21
View File
@@ -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
```
+1
View File
@@ -0,0 +1 @@
export * from "../../server.ts";
+1
View File
@@ -0,0 +1 @@
export * from "../../runtime.ts";
+4
View File
@@ -0,0 +1,4 @@
import { start } from "../../server.ts";
import routes from "./routes.gen.ts";
start(routes);
+9
View File
@@ -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>;
}
+5
View File
@@ -0,0 +1,5 @@
import { oak } from "../../api_deps.ts";
export default (ctx: oak.Context) => {
ctx.response.body = { name: "fresh" };
};
+9
View File
@@ -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>
);
}
+18
View File
@@ -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;
+6
View File
@@ -0,0 +1,6 @@
{
"compilerOptions": {
"jsxFactory": "h",
"jsxFragmentFactory": "Fragment"
}
}