Skip to content

Commit a377248

Browse files
committed
fix testings
1 parent cd37c3e commit a377248

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+8036
-13876
lines changed

apps/web/__tests__/pages/api/auth.test.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
1+
/**
2+
* @jest-environment node
3+
*/
4+
15
import handler from 'pages/api/signup';
2-
import { build } from '@linen/factory';
6+
import { build } from '@linen/factory-client';
37
import type { NextApiRequest, NextApiResponse } from 'next';
48
import { sendNotification } from 'services/slack';
59
import { v4 } from 'uuid';

apps/web/__tests__/pages/api/merge/index.test.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
1+
/**
2+
* @jest-environment node
3+
*/
4+
15
import * as api from 'pages/api/merge';
2-
import { build, create } from '@linen/factory';
6+
import { create } from '@linen/factory';
7+
import { build } from '@linen/factory-client';
38

49
describe('create', () => {
510
it('returns 400 if from param is empty', async () => {

apps/web/__tests__/pages/api/move/thread/channel/index.test.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
1+
/**
2+
* @jest-environment node
3+
*/
4+
15
import * as api from 'pages/api/move/thread/channel';
2-
import { build, create } from '@linen/factory';
6+
import { create } from '@linen/factory';
7+
import { build } from '@linen/factory-client';
38

49
describe('create', () => {
510
it('returns 400 when threadId is missing', async () => {

apps/web/__tests__/pages/api/search.test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
/**
2+
* @jest-environment node
3+
*/
4+
15
import { accounts, AccountType, users } from '@linen/database';
26
import {
37
createAccount,

apps/web/__tests__/pages/api/signin/index.test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
/**
2+
* @jest-environment node
3+
*/
4+
15
import * as api from 'pages/api/signin';
26
import { createAuth } from '@linen/factory';
37
import { v4 } from 'uuid';

apps/web/__tests__/pages/api/signup/index.test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
/**
2+
* @jest-environment node
3+
*/
4+
15
import { testApiHandler } from 'next-test-api-route-handler';
26
import handler from 'pages/api/signup';
37

apps/web/__tests__/topics.test.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
/**
2+
* @jest-environment node
3+
*/
4+
15
import { createAccount, createChannel } from '@linen/factory';
26
import {
37
SerializedThread,
@@ -43,6 +47,9 @@ describe('topic view', () => {
4347
communityName: account.redirectDomain as string,
4448
channelName: channel.channelName,
4549
},
50+
req: {
51+
headers: {},
52+
},
4653
} as any,
4754
isSubdomain
4855
);

apps/web/components/layout/PageLayout/index.test.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
import React from 'react';
21
import { render } from '@testing-library/react';
32
import PageLayout from '.';
4-
import { build } from '@linen/factory';
3+
import { build } from '@linen/factory-client';
54
import { SessionProvider } from '@linen/auth-client/client';
65

76
describe('PageLayout', () => {

apps/web/jest.config.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,17 @@ const customJestConfig = {
1616
// if using TypeScript with a baseUrl set to the root directory then you need the below for alias' to work
1717
moduleDirectories: ['node_modules', '<rootDir>/'],
1818
moduleNameMapper: {
19-
'@linen/hooks/(.*)/(.*)': '<rootDir>/../../packages/hooks/dist/$1/$2',
19+
'@linen/hooks/(.*)/(.*)': '<rootDir>/hooks/$1/$2',
20+
'@linen/hooks/(.*)': '<rootDir>/hooks/$1',
21+
'@linen/ui/(.*)': '<rootDir>/ui/$1',
2022
'@linen/(.*)/(.*)': '<rootDir>/../../packages/$1/dist/$2',
2123
'@linen/(.*)': '<rootDir>/../../packages/$1',
2224
'^axios$': require.resolve('axios'),
2325
'^uuid$': require.resolve('uuid'),
2426
'^jose$': require.resolve('jose'),
2527
'@panva/hkdf': require.resolve('@panva/hkdf'),
28+
'@/(.*)$': '<rootDir>/ui/$1',
29+
'\\.(css|scss)$': 'identity-obj-proxy',
2630
},
2731
testEnvironment: 'jest-environment-jsdom',
2832
setupFilesAfterEnv: ['<rootDir>/jest.setup.js'],

apps/web/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"test:watch": "jest --watch",
1212
"test:coverage": "jest --coverage",
1313
"db:migrate": "npx prisma generate && npx prisma migrate dev",
14-
"db:migrate:test": "dotenv -e .env.test -- npx prisma generate && npx prisma migrate dev",
14+
"db:migrate:test": "dotenv -e .env.test prisma generate && dotenv -e .env.test prisma migrate dev",
1515
"db:seed": "ts-node --skip-project bin/seed.ts",
1616
"typecheck": "tsc -P tsconfig.types.json --noEmit --watch "
1717
},
@@ -25,6 +25,7 @@
2525
"@linen/contexts": "*",
2626
"@linen/database": "*",
2727
"@linen/factory": "*",
28+
"@linen/factory-client": "*",
2829
"@linen/integration-email": "*",
2930
"@linen/integration-github": "*",
3031
"@linen/integration-linear": "*",
@@ -122,7 +123,6 @@
122123
"tsup": "^6.7.0",
123124
"tsx": "^3.12.7",
124125
"typescript": "^5.1.3",
125-
"@linen/rollup-plugin-scss-modules": "*",
126126
"@rollup/plugin-commonjs": "^24.0.1",
127127
"@rollup/plugin-json": "^6.0.0",
128128
"@rollup/plugin-node-resolve": "^15.0.1",

0 commit comments

Comments
 (0)