Skip to content

Commit 25e8d35

Browse files
committed
fix a duplication error
1 parent 82a8e1a commit 25e8d35

File tree

1 file changed

+25
-20
lines changed

1 file changed

+25
-20
lines changed

packages/amazonq/test/unit/lsp/chat/diffAnimation/diffAnimationController.test.ts

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -58,22 +58,6 @@ describe('DiffAnimationController', function () {
5858
await controller.startDiffAnimation(filePath, originalContent, newContent, false)
5959
}
6060

61-
// Helper function to setup animation and verify disposal
62-
async function setupAnimationAndDispose(filePath: string, originalContent: string, newContent: string) {
63-
await setupAnimation(filePath, originalContent, newContent)
64-
controller.dispose()
65-
const stats = controller.getAnimationStats()
66-
assert.strictEqual(stats.activeCount, 0)
67-
}
68-
69-
// Helper function to setup animation and stop it
70-
async function setupAnimationAndStop(filePath: string, originalContent: string, newContent: string) {
71-
await setupAnimation(filePath, originalContent, newContent)
72-
controller.stopDiffAnimation(filePath)
73-
const animationData = controller.getAnimationData(filePath)
74-
assert.strictEqual(animationData, undefined)
75-
}
76-
7761
beforeEach(function () {
7862
sandbox = sinon.createSandbox()
7963

@@ -319,7 +303,14 @@ describe('DiffAnimationController', function () {
319303

320304
describe('stopDiffAnimation', function () {
321305
it('should stop animation for specific file', async function () {
322-
await setupAnimationAndStop('/test/file.js', 'original', 'new')
306+
const filePath = '/test/file.js'
307+
const originalContent = 'original'
308+
const newContent = 'new'
309+
310+
await setupAnimation(filePath, originalContent, newContent)
311+
controller.stopDiffAnimation(filePath)
312+
const animationData = controller.getAnimationData(filePath)
313+
assert.strictEqual(animationData, undefined)
323314
})
324315

325316
it('should handle stopping non-existent animation', function () {
@@ -375,9 +366,16 @@ describe('DiffAnimationController', function () {
375366
})
376367

377368
it('should return false after stopping animation', async function () {
378-
await setupAnimationAndStop('/test/file.js', 'original', 'new')
369+
const filePath = '/test/file.js'
370+
const originalContent = 'original'
371+
const newContent = 'new'
372+
373+
await setupAnimation(filePath, originalContent, newContent)
374+
controller.stopDiffAnimation(filePath)
375+
const animationData = controller.getAnimationData(filePath)
376+
assert.strictEqual(animationData, undefined)
379377

380-
const result = controller.isAnimating('/test/file.js')
378+
const result = controller.isAnimating(filePath)
381379
assert.strictEqual(result, false)
382380
})
383381
})
@@ -434,7 +432,14 @@ describe('DiffAnimationController', function () {
434432
})
435433

436434
it('should stop all animations on dispose', async function () {
437-
await setupAnimationAndDispose('/test/file.js', 'original', 'new')
435+
const filePath = '/test/file.js'
436+
const originalContent = 'original'
437+
const newContent = 'new'
438+
439+
await setupAnimation(filePath, originalContent, newContent)
440+
controller.dispose()
441+
const stats = controller.getAnimationStats()
442+
assert.strictEqual(stats.activeCount, 0)
438443
})
439444

440445
it('should handle multiple dispose calls', function () {

0 commit comments

Comments
 (0)