test(server): add validation test of api:notes/create (#10090)
* fix(server): notes/createのバリデーションが効いていない
Fix #10079
Co-Authored-By: mei23 <m@m544.net>
* anyOf内にバリデーションを書いても最初の一つしかチェックされない
* ✌️
* wip
* wip
* ✌️
* RequiredProp
* Revert "RequiredProp"
This reverts commit 7469390011
.
* add api:notes/create
* fix lint
* text
* ✌️
* improve readability
---------
Co-authored-by: mei23 <m@m544.net>
Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
This commit is contained in:
11
packages/backend/test/prelude/get-api-validator.ts
Normal file
11
packages/backend/test/prelude/get-api-validator.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import { Schema } from '@/misc/schema';
|
||||
import Ajv from 'ajv';
|
||||
|
||||
export const getValidator = (paramDef: Schema) => {
|
||||
const ajv = new Ajv({
|
||||
useDefaults: true,
|
||||
});
|
||||
ajv.addFormat('misskey:id', /^[a-zA-Z0-9]+$/);
|
||||
|
||||
return ajv.compile(paramDef);
|
||||
}
|
7
packages/backend/test/resources/misskey.svg
Normal file
7
packages/backend/test/resources/misskey.svg
Normal file
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 9.2 KiB |
@@ -33,11 +33,12 @@
|
||||
"lib": [
|
||||
"esnext"
|
||||
],
|
||||
"types": ["jest"]
|
||||
"types": ["jest", "node"]
|
||||
},
|
||||
"compileOnSave": false,
|
||||
"include": [
|
||||
"./**/*.ts",
|
||||
"../src/**/*.test.ts",
|
||||
"../src/@types/**/*.ts",
|
||||
]
|
||||
}
|
||||
|
Reference in New Issue
Block a user