forked from hangshuo652/aurak
feat: implement QuestionBank CRUD with pagination and template query
- Add pagination support to findAll (page, limit query params) - Add findByTemplateId method to service - Add GET /by-template/:templateId endpoint to controller - Service already includes CRUD for QuestionBank and QuestionBankItem
This commit is contained in:
@@ -0,0 +1,122 @@
|
||||
yarn run v1.22.22
|
||||
$ jest server/src/feishu/services/assessment-command.parser.spec.ts
|
||||
FAIL src/feishu/services/assessment-command.parser.spec.ts
|
||||
AssessmentCommandParser
|
||||
parse
|
||||
× should parse start command without parameters (4 ms)
|
||||
× should parse start command with parameters (1 ms)
|
||||
× should parse answer command (1 ms)
|
||||
× should parse Chinese commands (1 ms)
|
||||
√ should return null for non-assessment commands
|
||||
isAssessmentCommand
|
||||
√ should return true for valid commands (1 ms)
|
||||
√ should return false for invalid commands
|
||||
|
||||
● AssessmentCommandParser › parse › should parse start command without parameters
|
||||
|
||||
expect(received).toEqual(expected) // deep equality
|
||||
|
||||
- Expected - 0
|
||||
+ Received + 2
|
||||
|
||||
Object {
|
||||
"parameters": Array [],
|
||||
+ "rawMessage": "/assessment start",
|
||||
+ "timestamp": 2026-03-17T06:51:53.623Z,
|
||||
"type": "start",
|
||||
}
|
||||
|
||||
12 | it('should parse start command without parameters', () => {
|
||||
13 | const result = parser.parse('/assessment start');
|
||||
> 14 | expect(result).toEqual({
|
||||
| ^
|
||||
15 | type: AssessmentCommandType.START,
|
||||
16 | parameters: [],
|
||||
17 | });
|
||||
|
||||
at Object.<anonymous> (feishu/services/assessment-command.parser.spec.ts:14:22)
|
||||
|
||||
● AssessmentCommandParser › parse › should parse start command with parameters
|
||||
|
||||
expect(received).toEqual(expected) // deep equality
|
||||
|
||||
- Expected - 0
|
||||
+ Received + 2
|
||||
|
||||
Object {
|
||||
"parameters": Array [
|
||||
"kb_123",
|
||||
],
|
||||
+ "rawMessage": "/assessment start kb_123",
|
||||
+ "timestamp": 2026-03-17T06:51:53.629Z,
|
||||
"type": "start",
|
||||
}
|
||||
|
||||
20 | it('should parse start command with parameters', () => {
|
||||
21 | const result = parser.parse('/assessment start kb_123');
|
||||
> 22 | expect(result).toEqual({
|
||||
| ^
|
||||
23 | type: AssessmentCommandType.START,
|
||||
24 | parameters: ['kb_123'],
|
||||
25 | });
|
||||
|
||||
at Object.<anonymous> (feishu/services/assessment-command.parser.spec.ts:22:22)
|
||||
|
||||
● AssessmentCommandParser › parse › should parse answer command
|
||||
|
||||
expect(received).toEqual(expected) // deep equality
|
||||
|
||||
- Expected - 0
|
||||
+ Received + 2
|
||||
|
||||
Object {
|
||||
"parameters": Array [
|
||||
"my",
|
||||
"answer",
|
||||
],
|
||||
+ "rawMessage": "/assessment answer my answer",
|
||||
+ "timestamp": 2026-03-17T06:51:53.630Z,
|
||||
"type": "answer",
|
||||
}
|
||||
|
||||
28 | it('should parse answer command', () => {
|
||||
29 | const result = parser.parse('/assessment answer my answer');
|
||||
> 30 | expect(result).toEqual({
|
||||
| ^
|
||||
31 | type: AssessmentCommandType.ANSWER,
|
||||
32 | parameters: ['my', 'answer'],
|
||||
33 | });
|
||||
|
||||
at Object.<anonymous> (feishu/services/assessment-command.parser.spec.ts:30:22)
|
||||
|
||||
● AssessmentCommandParser › parse › should parse Chinese commands
|
||||
|
||||
expect(received).toEqual(expected) // deep equality
|
||||
|
||||
- Expected - 0
|
||||
+ Received + 2
|
||||
|
||||
Object {
|
||||
"parameters": Array [],
|
||||
+ "rawMessage": "/测评 开始",
|
||||
+ "timestamp": 2026-03-17T06:51:53.631Z,
|
||||
"type": "start",
|
||||
}
|
||||
|
||||
36 | it('should parse Chinese commands', () => {
|
||||
37 | const result = parser.parse('/测评 开始');
|
||||
> 38 | expect(result).toEqual({
|
||||
| ^
|
||||
39 | type: AssessmentCommandType.START,
|
||||
40 | parameters: [],
|
||||
41 | });
|
||||
|
||||
at Object.<anonymous> (feishu/services/assessment-command.parser.spec.ts:38:22)
|
||||
|
||||
Test Suites: 1 failed, 1 total
|
||||
Tests: 4 failed, 3 passed, 7 total
|
||||
Snapshots: 0 total
|
||||
Time: 2.629 s, estimated 3 s
|
||||
Ran all test suites matching server/src/feishu/services/assessment-command.parser.spec.ts.
|
||||
error Command failed with exit code 1.
|
||||
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
|
||||
Reference in New Issue
Block a user