mirror of
https://github.com/cloudflare/wrangler-action.git
synced 2024-11-24 02:44:45 +01:00
Add wangler files in fixtures
This commit is contained in:
parent
f0cc3efccf
commit
aec73ae744
8 changed files with 95 additions and 0 deletions
1
test/empty/index.ts
Normal file
1
test/empty/index.ts
Normal file
|
@ -0,0 +1 @@
|
||||||
|
export default {};
|
4
test/empty/wrangler.toml
Normal file
4
test/empty/wrangler.toml
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
name = "wrangler-action-test"
|
||||||
|
main = "./index.ts"
|
||||||
|
compatibility_date = "2023-07-07"
|
||||||
|
workers_dev = true
|
26
test/npm/index.ts
Normal file
26
test/npm/index.ts
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
type Env = {
|
||||||
|
SECRET1?: string;
|
||||||
|
SECRET2?: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export default {
|
||||||
|
fetch(request: Request, env: Env) {
|
||||||
|
const url = new URL(request.url);
|
||||||
|
|
||||||
|
if (url.pathname === "/secret-health-check") {
|
||||||
|
const { SECRET1, SECRET2 } = env;
|
||||||
|
|
||||||
|
if (SECRET1 !== "SECRET_1_VALUE" || SECRET2 !== "SECRET_2_VALUE") {
|
||||||
|
throw new Error("SECRET1 or SECRET2 is not defined");
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Response("OK");
|
||||||
|
}
|
||||||
|
|
||||||
|
// @ts-expect-error
|
||||||
|
return Response.json({
|
||||||
|
...request,
|
||||||
|
headers: Object.fromEntries(request.headers),
|
||||||
|
});
|
||||||
|
},
|
||||||
|
};
|
4
test/npm/wrangler.toml
Normal file
4
test/npm/wrangler.toml
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
name = "wrangler-action-test"
|
||||||
|
main = "./index.ts"
|
||||||
|
compatibility_date = "2023-07-07"
|
||||||
|
workers_dev = true
|
26
test/pnpm/index.ts
Normal file
26
test/pnpm/index.ts
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
type Env = {
|
||||||
|
SECRET1?: string;
|
||||||
|
SECRET2?: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export default {
|
||||||
|
fetch(request: Request, env: Env) {
|
||||||
|
const url = new URL(request.url);
|
||||||
|
|
||||||
|
if (url.pathname === "/secret-health-check") {
|
||||||
|
const { SECRET1, SECRET2 } = env;
|
||||||
|
|
||||||
|
if (SECRET1 !== "SECRET_1_VALUE" || SECRET2 !== "SECRET_2_VALUE") {
|
||||||
|
throw new Error("SECRET1 or SECRET2 is not defined");
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Response("OK");
|
||||||
|
}
|
||||||
|
|
||||||
|
// @ts-expect-error
|
||||||
|
return Response.json({
|
||||||
|
...request,
|
||||||
|
headers: Object.fromEntries(request.headers),
|
||||||
|
});
|
||||||
|
},
|
||||||
|
};
|
4
test/pnpm/wrangler.toml
Normal file
4
test/pnpm/wrangler.toml
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
name = "wrangler-action-test"
|
||||||
|
main = "./index.ts"
|
||||||
|
compatibility_date = "2023-07-07"
|
||||||
|
workers_dev = true
|
26
test/yarn/index.ts
Normal file
26
test/yarn/index.ts
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
type Env = {
|
||||||
|
SECRET1?: string;
|
||||||
|
SECRET2?: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export default {
|
||||||
|
fetch(request: Request, env: Env) {
|
||||||
|
const url = new URL(request.url);
|
||||||
|
|
||||||
|
if (url.pathname === "/secret-health-check") {
|
||||||
|
const { SECRET1, SECRET2 } = env;
|
||||||
|
|
||||||
|
if (SECRET1 !== "SECRET_1_VALUE" || SECRET2 !== "SECRET_2_VALUE") {
|
||||||
|
throw new Error("SECRET1 or SECRET2 is not defined");
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Response("OK");
|
||||||
|
}
|
||||||
|
|
||||||
|
// @ts-expect-error
|
||||||
|
return Response.json({
|
||||||
|
...request,
|
||||||
|
headers: Object.fromEntries(request.headers),
|
||||||
|
});
|
||||||
|
},
|
||||||
|
};
|
4
test/yarn/wrangler.toml
Normal file
4
test/yarn/wrangler.toml
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
name = "wrangler-action-test"
|
||||||
|
main = "./index.ts"
|
||||||
|
compatibility_date = "2023-07-07"
|
||||||
|
workers_dev = true
|
Loading…
Reference in a new issue