Skip to content

Commit 8afbc3c

Browse files
committed
fix unit tests
1 parent 8c04cd6 commit 8afbc3c

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

backend/src/__tests__/process-str-replace.test.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,6 @@ describe('processStrReplace', () => {
262262
expect(result).not.toBeNull()
263263
expect('content' in result).toBe(true)
264264
if ('content' in result) {
265-
266265
expect(result.content).toBe('FOO bar FOO baz FOO')
267266
}
268267
})
@@ -305,8 +304,9 @@ describe('processStrReplace', () => {
305304
// Should have applied foo->FOO and qux qux->QUX, but not baz->BAZ
306305

307306
expect(result.content).toBe('FOO bar FOO\nbaz baz baz\nQUX')
308-
expect(result.messages).toContain('Found 3 occurrences of "baz"')
309-
expect(result.messages).toContain('set allowMultiple to true')
307+
expect(result.messages).toHaveLength(1)
308+
expect(result.messages[0]).toContain('Found 3 occurrences of "baz"')
309+
expect(result.messages[0]).toContain('set allowMultiple to true')
310310
}
311311
})
312312

@@ -321,7 +321,7 @@ function test3() {
321321
console.log('info');
322322
}`
323323
const oldStr = "console.log('debug');"
324-
const newStr = "// removed debug log"
324+
const newStr = '// removed debug log'
325325

326326
const result = await processStrReplace(
327327
'test.ts',
@@ -334,7 +334,9 @@ function test3() {
334334
if ('content' in result) {
335335
expect(result.content).toContain('// removed debug log')
336336
// Should have replaced both debug logs but not the info log
337-
expect((result.content.match(/removed debug log/g) || []).length).toBe(2)
337+
expect((result.content.match(/removed debug log/g) || []).length).toBe(
338+
2,
339+
)
338340
expect(result.content).toContain("console.log('info');")
339341
}
340342
})

0 commit comments

Comments
 (0)