Skip to content

Commit b8b8a24

Browse files
committed
refactor(common): consolidate testing exports to 2 entries
1 parent 6be1bac commit b8b8a24

Some content is hidden

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

41 files changed

+41
-72
lines changed

cli/src/__tests__/integration/credentials-storage.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import path from 'path'
55
import {
66
clearMockedModules,
77
mockModule,
8-
} from '@codebuff/common/testing/mock-modules'
8+
} from '@codebuff/common/testing/fixtures'
99
import {
1010
describe,
1111
test,

cli/testing/env.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* Test-only CLI env fixtures.
33
*/
44

5-
import { createTestBaseEnv } from '@codebuff/common/testing/env-process'
5+
import { createTestBaseEnv } from '@codebuff/common/testing/fixtures'
66

77
import type { CliEnv } from '../src/types/env'
88

common/package.json

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -22,30 +22,6 @@
2222
"import": "./testing/fixtures/*.ts",
2323
"types": "./testing/fixtures/*.ts",
2424
"default": "./testing/fixtures/*.ts"
25-
},
26-
"./testing/env-process": {
27-
"bun": "./testing/env-process.ts",
28-
"import": "./testing/env-process.ts",
29-
"types": "./testing/env-process.ts",
30-
"default": "./testing/env-process.ts"
31-
},
32-
"./testing/env-ci": {
33-
"bun": "./testing/env-ci.ts",
34-
"import": "./testing/env-ci.ts",
35-
"types": "./testing/env-ci.ts",
36-
"default": "./testing/env-ci.ts"
37-
},
38-
"./testing/mock-modules": {
39-
"bun": "./testing/mock-modules.ts",
40-
"import": "./testing/mock-modules.ts",
41-
"types": "./testing/mock-modules.ts",
42-
"default": "./testing/mock-modules.ts"
43-
},
44-
"./testing/impl/*": {
45-
"bun": "./testing/impl/*.ts",
46-
"import": "./testing/impl/*.ts",
47-
"types": "./testing/impl/*.ts",
48-
"default": "./testing/impl/*.ts"
4925
}
5026
},
5127
"scripts": {

common/src/__tests__/env-ci.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { describe, test, expect, afterEach } from 'bun:test'
22

33
import { getCiEnv, ciEnv, isCI } from '../env-ci'
4-
import { createTestCiEnv } from '../../testing/env-ci'
4+
import { createTestCiEnv } from '../../testing/fixtures'
55

66
describe('env-ci', () => {
77
describe('getCiEnv', () => {

common/src/__tests__/env-process.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { describe, test, expect, afterEach } from 'bun:test'
22

33
import { getProcessEnv, processEnv } from '../env-process'
4-
import { createTestProcessEnv } from '../../testing/env-process'
4+
import { createTestProcessEnv } from '../../testing/fixtures'
55

66
describe('env-process', () => {
77
describe('getProcessEnv', () => {

common/src/env-schema.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export const clientEnvSchema = z.object({
1414
.url()
1515
.min(1)
1616
.default('https://us.i.posthog.com'),
17-
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY: z.string().min(1).optional(),
17+
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY: z.string().min(1),
1818
NEXT_PUBLIC_STRIPE_CUSTOMER_PORTAL: z.url().min(1).optional(),
1919
NEXT_PUBLIC_GOOGLE_SITE_VERIFICATION_ID: z.string().optional(),
2020
NEXT_PUBLIC_WEB_PORT: z.coerce.number().min(1000).default(3000),

common/testing/fixtures/index.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,10 @@ export {
5757
type MockFetchFn,
5858
type MockFetchResponseConfig,
5959
} from './fetch'
60+
61+
// Environment fixtures
62+
export { createTestBaseEnv, createTestProcessEnv } from './env-process'
63+
export { createTestCiEnv } from './env-ci'
64+
65+
// Module mocking utilities
66+
export { mockModule, clearMockedModules, type MockResult } from './mock-modules'

0 commit comments

Comments
 (0)