-
Notifications
You must be signed in to change notification settings - Fork 573
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
842e183
commit de05feb
Showing
154 changed files
with
1,499 additions
and
2,395 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,7 +1,17 @@ | ||
// jest.config.js | ||
const base = require('./jest.config.base.js') | ||
|
||
module.exports = { | ||
...base, | ||
projects: ['<rootDir>/packages/*/jest.config.js'], | ||
projects: [ | ||
// '<rootDir>/packages/*/jest.config.js' | ||
|
||
|
||
'<rootDir>/packages/api/jest.config.js', | ||
'<rootDir>/packages/common/jest.config.js', | ||
'<rootDir>/packages/common-web/jest.config.js', | ||
'<rootDir>/packages/crypto/jest.config.js', | ||
'<rootDir>/packages/identity/jest.config.js', | ||
'<rootDir>/packages/lexicon/jest.config.js', | ||
'<rootDir>/packages/repo/jest.config.js', | ||
'<rootDir>/packages/syntax/jest.config.js', | ||
// '<rootDir>/packages/xrpc/jest.config.js', | ||
'<rootDir>/packages/xrpc-server/jest.config.js', | ||
], | ||
} |
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,6 +1,7 @@ | ||
const base = require('../../jest.config.base.js') | ||
|
||
/** @type {import('jest').Config} */ | ||
module.exports = { | ||
...base, | ||
displayName: 'API', | ||
transform: { '^.+\\.(t|j)s?$': '@swc/jest' }, | ||
transformIgnorePatterns: [`<rootDir>/node_modules/(?!get-port)`], | ||
setupFiles: ['<rootDir>/jest.setup.ts'], | ||
} |
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,19 @@ | ||
declare namespace jest { | ||
interface Matchers<R, T = {}> { | ||
toBeModerationResult( | ||
expected: ModerationBehaviorResult | undefined, | ||
context: string, | ||
stringifiedResult: string, | ||
ignoreCause?: boolean, | ||
): R | ||
} | ||
|
||
interface Expect { | ||
toBeModerationResult( | ||
expected: ModerationBehaviorResult | undefined, | ||
context: string, | ||
stringifiedResult: string, | ||
ignoreCause?: boolean, | ||
): void | ||
} | ||
} |
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,79 @@ | ||
import { ModerationBehaviorResult } from './definitions/moderation-behaviors' | ||
import { ModerationUI } from './src' | ||
|
||
expect.extend({ | ||
toBeModerationResult( | ||
actual: ModerationUI, | ||
expected: ModerationBehaviorResult | undefined, | ||
context: string, | ||
stringifiedResult: string, | ||
ignoreCause = false, | ||
) { | ||
const fail = (msg: string) => ({ | ||
pass: false, | ||
message: () => `${msg}. Full result: ${stringifiedResult}`, | ||
}) | ||
let cause = actual.cause?.type as string | ||
if (actual.cause?.type === 'label') { | ||
cause = `label:${actual.cause.labelDef.id}` | ||
} else if (actual.cause?.type === 'muted') { | ||
if (actual.cause.source.type === 'list') { | ||
cause = 'muted-by-list' | ||
} | ||
} else if (actual.cause?.type === 'blocking') { | ||
if (actual.cause.source.type === 'list') { | ||
cause = 'blocking-by-list' | ||
} | ||
} | ||
if (!expected) { | ||
if (!ignoreCause && actual.cause) { | ||
return fail(`${context} expected to be a no-op, got ${cause}`) | ||
} | ||
if (actual.alert) { | ||
return fail(`${context} expected to be a no-op, got alert=true`) | ||
} | ||
if (actual.blur) { | ||
return fail(`${context} expected to be a no-op, got blur=true`) | ||
} | ||
if (actual.filter) { | ||
return fail(`${context} expected to be a no-op, got filter=true`) | ||
} | ||
if (actual.noOverride) { | ||
return fail(`${context} expected to be a no-op, got noOverride=true`) | ||
} | ||
} else { | ||
if (!ignoreCause && cause !== expected.cause) { | ||
return fail(`${context} expected to be ${expected.cause}, got ${cause}`) | ||
} | ||
if (!!actual.alert !== !!expected.alert) { | ||
return fail( | ||
`${context} expected to be alert=${expected.alert || false}, got ${ | ||
actual.alert || false | ||
}`, | ||
) | ||
} | ||
if (!!actual.blur !== !!expected.blur) { | ||
return fail( | ||
`${context} expected to be blur=${expected.blur || false}, got ${ | ||
actual.blur || false | ||
}`, | ||
) | ||
} | ||
if (!!actual.filter !== !!expected.filter) { | ||
return fail( | ||
`${context} expected to be filter=${expected.filter || false}, got ${ | ||
actual.filter || false | ||
}`, | ||
) | ||
} | ||
if (!!actual.noOverride !== !!expected.noOverride) { | ||
return fail( | ||
`${context} expected to be noOverride=${ | ||
expected.noOverride || false | ||
}, got ${actual.noOverride || false}`, | ||
) | ||
} | ||
} | ||
return { pass: true, message: () => '' } | ||
}, | ||
}) |
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
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 |
---|---|---|
@@ -1,4 +1,8 @@ | ||
{ | ||
"extends": "./tsconfig.json", | ||
"exclude": ["**/*.spec.ts", "**/*.test.ts"] | ||
"extends": "../../tsconfig/base.json", | ||
"compilerOptions": { | ||
"rootDir": "./src", | ||
"outDir": "./dist", | ||
}, | ||
"include": ["./src"] | ||
} |
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 |
---|---|---|
@@ -1,13 +1,8 @@ | ||
{ | ||
"extends": "../../tsconfig.json", | ||
"compilerOptions": { | ||
"rootDir": "./src", | ||
"outDir": "./dist", // Your outDir, | ||
"emitDeclarationOnly": true | ||
}, | ||
"include": ["./src"], | ||
"include": [], | ||
"references": [ | ||
{ "path": "../xrpc/tsconfig.build.json" }, | ||
{ "path": "../lex-cli/tsconfig.build.json" } | ||
{ "path": "./tsconfig.build.json" }, | ||
{ "path": "./tsconfig.scripts.json" }, | ||
{ "path": "./tsconfig.test.json" } | ||
] | ||
} |
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,8 @@ | ||
{ | ||
"extends": "../../tsconfig/scripts.json", | ||
"compilerOptions": { | ||
"rootDir": "." | ||
}, | ||
"include": ["./*.js", "./*.ts"], | ||
"exclude": ["node_modules", "./jest.setup.ts"] | ||
} |
Oops, something went wrong.