Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nathan/convert repsonse verification tests to bun #223

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ This package encapsulates the protocol for such verification. It is used by [the
| `cargo doc -p ic-response-verification --no-deps --open` | Build Cargo crate docs |
| `pnpm run -F @dfinity/response-verification build` | Build NPM package |
| `pnpm run -F @dfinity/response-verification test` | Test NPM package |
| `./scripts/e2e/sh` | Run e2e tests |
| `./scripts/e2e.sh` | Run e2e tests |

### Certificate Verification

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This is another sample asset!
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Bonjour le monde !
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width" />
<title>canister</title>
<base href="/" />
<link rel="icon" href="favicon.ico" />
<link type="text/css" rel="stylesheet" href="main.css" />
</head>

<body>
<main>
<h1>Hello World!</h1>
</main>
</body>

</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width" />
<title>canister</title>
<base href="/" />
<link rel="icon" href="favicon.ico" />
<link type="text/css" rel="stylesheet" href="main.css" />
</head>

<body>
<main>
<h1>Hello World?????</h1>
</main>
</body>

</html>
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"frontend": {
"entrypoint": "canisters/frontend/src/index.html"
},
"source": ["canisters/frontend/assets", "dist/frontend/"],
"source": ["dist/frontend/"],
"type": "assets"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ module.exports = {
to: '.ic-assets.json5',
noErrorOnMissing: true,
},
{
from: 'canisters/frontend/assets',
to: '.',
noErrorOnMissing: true,
},
],
}),
],
Expand Down
16 changes: 0 additions & 16 deletions packages/ic-response-verification-tests/package.json

This file was deleted.

20 changes: 14 additions & 6 deletions packages/ic-response-verification-tests/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,20 +77,28 @@ async fn v2_test(canister_id: &str, agent: &Agent) -> Result<()> {
let test_cases = [
["GET", "/index.html", "dist/frontend/index.html"], // load index.html when requesting /index.html
["GET", "/", "dist/frontend/index.html"], // load index.html when requesting trailing slash
[
"GET",
"/sample-asset.txt",
"canisters/frontend/assets/sample-asset.txt",
], // load sample text asset when requesting /sample-asset.txt
["GET", "/hello", "dist/frontend/hello/index.html"], // load hello/index.html when requesting /hello
["GET", "/hello/", "dist/frontend/hello/index.html"], // load hello/index.html when requesting /hello/ with trailing slash
["GET", "/hello/index.html", "dist/frontend/hello/index.html"], // load hello/index.html when requesting full file path
// *** /world.html ***
["GET", "/world", "dist/frontend/world.html"], // load hello/index.html when requesting /hello
["GET", "/world.html", "dist/frontend/world.html"], // load hello/index.html when requesting full file path
["GET", "/sample-asset.txt", "dist/frontend/sample-asset.txt"], // load sample text asset when requesting /sample-asset.txt
[
"GET",
"/%73ample-asset.txt",
"canisters/frontend/assets/sample-asset.txt",
"dist/frontend/sample-asset.txt",
], // load sample text asset when requesting /sample-asset.txt with encoding
["GET", "/index.js", "dist/frontend/index.js"], // load sample js asset when requesting /index.js
["GET", "/not-found", "dist/frontend/index.html"], // fallback to index.html on not found path
["GET", "/not/found", "dist/frontend/index.html"], // fallback to index.html on not found path
["GET", "/a/b/not-found", "dist/frontend/index.html"], // fallback to index.html on not found path
["GET", "/world/", "dist/frontend/index.html"], // load hello/index.html when requesting /hello/ with trailing slash
["GET", "/world/not-found", "dist/frontend/index.html"], // fallback to index.html on not found path that has an existing asset on a sub path

// currently broken: see SDK-1298
// ["GET", "/hello/not-found", "dist/frontend/index.html"],
// fallback to index.html on not found path that has an existing asset on a sub path
];

for [http_method, http_path, file_path] in test_cases.into_iter() {
Expand Down
6 changes: 0 additions & 6 deletions packages/ic-response-verification-tests/tsconfig.json

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[test]
preload = ["./setup.ts"]

This file was deleted.

This file was deleted.

This file was deleted.

Loading
Loading