1- import {
2- analyzeDiffFiles ,
3- getDiffFiles ,
4- DIFF_FILE_PATTERNS ,
5- type DiffAnalysisResult ,
6- type DiffAgentScore ,
7- } from './diff-analyzer' ;
1+ import { analyzeDiffFiles , getDiffFiles , DIFF_FILE_PATTERNS } from './diff-analyzer' ;
82
93describe ( 'diff-analyzer' , ( ) => {
104 describe ( 'DIFF_FILE_PATTERNS' , ( ) => {
@@ -34,20 +28,14 @@ describe('diff-analyzer', () => {
3428 } ) ;
3529
3630 it ( 'should boost test-engineer for .test.ts files' , ( ) => {
37- const result = analyzeDiffFiles ( [
38- 'src/auth/login.test.ts' ,
39- 'src/auth/login.spec.ts' ,
40- ] ) ;
31+ const result = analyzeDiffFiles ( [ 'src/auth/login.test.ts' , 'src/auth/login.spec.ts' ] ) ;
4132 expect ( result . topAgent ) . not . toBeNull ( ) ;
4233 expect ( result . topAgent ! . agent ) . toBe ( 'test-engineer' ) ;
4334 expect ( result . topAgent ! . matchedFiles . length ) . toBe ( 2 ) ;
4435 } ) ;
4536
4637 it ( 'should boost devops-engineer for Dockerfile and .github/ files' , ( ) => {
47- const result = analyzeDiffFiles ( [
48- 'Dockerfile' ,
49- '.github/workflows/ci.yml' ,
50- ] ) ;
38+ const result = analyzeDiffFiles ( [ 'Dockerfile' , '.github/workflows/ci.yml' ] ) ;
5139 expect ( result . topAgent ) . not . toBeNull ( ) ;
5240 expect ( result . topAgent ! . agent ) . toBe ( 'devops-engineer' ) ;
5341 } ) ;
@@ -63,28 +51,19 @@ describe('diff-analyzer', () => {
6351 } ) ;
6452
6553 it ( 'should boost backend-developer for .py files' , ( ) => {
66- const result = analyzeDiffFiles ( [
67- 'hooks/pre-commit.py' ,
68- 'scripts/deploy.py' ,
69- ] ) ;
54+ const result = analyzeDiffFiles ( [ 'hooks/pre-commit.py' , 'scripts/deploy.py' ] ) ;
7055 expect ( result . topAgent ) . not . toBeNull ( ) ;
7156 expect ( result . topAgent ! . agent ) . toBe ( 'backend-developer' ) ;
7257 } ) ;
7358
7459 it ( 'should boost platform-engineer for .tf files' , ( ) => {
75- const result = analyzeDiffFiles ( [
76- 'infra/main.tf' ,
77- 'infra/variables.tf' ,
78- ] ) ;
60+ const result = analyzeDiffFiles ( [ 'infra/main.tf' , 'infra/variables.tf' ] ) ;
7961 expect ( result . topAgent ) . not . toBeNull ( ) ;
8062 expect ( result . topAgent ! . agent ) . toBe ( 'platform-engineer' ) ;
8163 } ) ;
8264
8365 it ( 'should boost data-engineer for .sql and migration files' , ( ) => {
84- const result = analyzeDiffFiles ( [
85- 'migrations/001_create_users.sql' ,
86- 'schema.prisma' ,
87- ] ) ;
66+ const result = analyzeDiffFiles ( [ 'migrations/001_create_users.sql' , 'schema.prisma' ] ) ;
8867 expect ( result . topAgent ) . not . toBeNull ( ) ;
8968 expect ( result . topAgent ! . agent ) . toBe ( 'data-engineer' ) ;
9069 } ) ;
@@ -121,9 +100,7 @@ describe('diff-analyzer', () => {
121100 ] ) ;
122101 expect ( result . scores . length ) . toBeGreaterThan ( 0 ) ;
123102 for ( let i = 1 ; i < result . scores . length ; i ++ ) {
124- expect ( result . scores [ i - 1 ] . score ) . toBeGreaterThanOrEqual (
125- result . scores [ i ] . score ,
126- ) ;
103+ expect ( result . scores [ i - 1 ] . score ) . toBeGreaterThanOrEqual ( result . scores [ i ] . score ) ;
127104 }
128105 } ) ;
129106
@@ -152,16 +129,10 @@ describe('diff-analyzer', () => {
152129 'src/components/Header.tsx' ,
153130 'README.md' , // no match
154131 ] ) ;
155- const frontendScore = result . scores . find (
156- ( s ) => s . agent === 'frontend-developer' ,
157- ) ;
132+ const frontendScore = result . scores . find ( s => s . agent === 'frontend-developer' ) ;
158133 expect ( frontendScore ) . toBeDefined ( ) ;
159- expect ( frontendScore ! . matchedFiles ) . toContain (
160- 'src/components/Button.tsx' ,
161- ) ;
162- expect ( frontendScore ! . matchedFiles ) . toContain (
163- 'src/components/Header.tsx' ,
164- ) ;
134+ expect ( frontendScore ! . matchedFiles ) . toContain ( 'src/components/Button.tsx' ) ;
135+ expect ( frontendScore ! . matchedFiles ) . toContain ( 'src/components/Header.tsx' ) ;
165136 expect ( frontendScore ! . matchedFiles ) . not . toContain ( 'README.md' ) ;
166137 } ) ;
167138 } ) ;
0 commit comments