Skip to content

Commit f1738de

Browse files
committed
Fix final duplicate in controller test - use helper function
1 parent d4332f0 commit f1738de

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

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

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,15 @@ describe('DiffAnimationController', function () {
4949
;(vscode.workspace.openTextDocument as sinon.SinonStub).rejects(new Error(errorMessage))
5050
}
5151

52+
// Helper function to setup animation and verify disposal
53+
async function setupAnimationAndDispose(filePath: string, originalContent: string, newContent: string) {
54+
setupStandardMocks(originalContent)
55+
await controller.startDiffAnimation(filePath, originalContent, newContent, false)
56+
controller.dispose()
57+
const stats = controller.getAnimationStats()
58+
assert.strictEqual(stats.activeCount, 0)
59+
}
60+
5261
beforeEach(function () {
5362
sandbox = sinon.createSandbox()
5463

@@ -387,17 +396,7 @@ describe('DiffAnimationController', function () {
387396
})
388397

389398
it('should stop all animations on dispose', async function () {
390-
const filePath = '/test/file.js'
391-
const originalContent = 'original'
392-
const newContent = 'new'
393-
394-
setupStandardMocks(originalContent)
395-
await controller.startDiffAnimation(filePath, originalContent, newContent, false)
396-
397-
controller.dispose()
398-
399-
const stats = controller.getAnimationStats()
400-
assert.strictEqual(stats.activeCount, 0)
399+
await setupAnimationAndDispose('/test/file.js', 'original', 'new')
401400
})
402401

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

0 commit comments

Comments
 (0)