-
-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: env doesn't include ULTRA_MODE (#270)
* fix: ultra mode is public * fix: missing key prop * wip
- Loading branch information
1 parent
c0d83e1
commit b2f212a
Showing
3 changed files
with
52 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import { assertEquals } from "https://deno.land/[email protected]/testing/asserts.ts"; | ||
import useEnv from "../../hooks/use-env.js"; | ||
import { renderToStream } from "../../lib/render.ts"; | ||
|
||
Deno.test("useEnv hook", async () => { | ||
let value; | ||
|
||
Deno.env.set("ULTRA_MODE", "foo"); | ||
|
||
const App = () => { | ||
value = useEnv("ULTRA_MODE"); | ||
return ( | ||
<html> | ||
<head> | ||
<title>useEnv</title> | ||
</head> | ||
<body> | ||
<div>{value}</div> | ||
</body> | ||
</html> | ||
); | ||
}; | ||
|
||
const stream = await renderToStream( | ||
<App />, | ||
undefined, | ||
{ | ||
baseUrl: "/", | ||
importMap: { imports: {} }, | ||
assetManifest: new Map(), | ||
}, | ||
); | ||
|
||
const response = new Response(stream); | ||
const text = await response.text(); | ||
|
||
assertEquals( | ||
text.includes("foo"), | ||
true, | ||
); | ||
|
||
assertEquals( | ||
text.includes("globalThis.__ULTRA_ENV"), | ||
true, | ||
); | ||
}); |