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

fix: client-side simulation does not work in test #157

Merged
merged 3 commits into from
Jan 12, 2024

Conversation

chungweileong94
Copy link
Contributor

fix #156

Copy link

vercel bot commented Dec 20, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
t3-env ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 12, 2024 10:35am

Copy link

vercel bot commented Dec 20, 2023

@chungweileong94 is attempting to deploy a commit to the t3-oss Team on Vercel.

A member of the Team first needs to authorize it.

@@ -336,17 +336,19 @@ describe("shared can be accessed on both server and client", () => {
FOO_BAR: "foo",
};

const env = createEnv({
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously we called createEnv before "simulate" the window object below, which mean we already get env in server mode.

Nothing change to the test result, but at least the client-side simulation is fixed.

});
const env = lazyCreateEnv();

expect(() => env.BAR).toThrowErrorMatchingInlineSnapshot(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically we don't have to check this in this test case, but I figure why not🤷

@juliusmarminge juliusmarminge added this pull request to the merge queue Jan 12, 2024
Merged via the queue into t3-oss:main with commit 6b6aca3 Jan 12, 2024
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tests should probably use .toEqual() instead of .toMatchObject()
2 participants