Skip to content

Commit 40db204

Browse files
kyranjamiefabric-8
authored andcommitted
fix(web): remove jsdom from vitest
1 parent fd1cec6 commit 40db204

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

apps/web/app/utils/post-link.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
export function getPostHref(slug: string) {
2-
// Check if the slug is already a full URL
3-
if (URL.canParse(slug)) {
4-
return slug; // Return the slug as-is if it's already a URL
2+
const trimmedSlug = slug.trim();
3+
4+
if (URL.canParse(trimmedSlug)) {
5+
return trimmedSlug;
56
}
67

7-
// Otherwise, construct the URL based on environment
8-
if (process.env.NODE_ENV === 'development') {
9-
return `https://prosperous-combination-099461.framer.app/posts/${slug}`;
8+
if (import.meta.env.DEV) {
9+
return `https://prosperous-combination-099461.framer.app/posts/${trimmedSlug}`;
1010
}
11-
return `https://leather.io/posts/${slug}`;
11+
12+
return `https://leather.io/posts/${trimmedSlug}`;
1213
}

apps/web/vitest.config.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ export default defineProject({
1414
},
1515
test: {
1616
...defaultVitestUnitTestingConfig.test,
17-
environment: 'jsdom',
1817
include: [
1918
'app/**/*.spec.{ts,tsx}',
2019
'app/**/*.test.{ts,tsx}',

0 commit comments

Comments
 (0)