Skip to content

Commit d33e110

Browse files
committed
Eliminate final duplicate with setupAnimationAndStop helper
1 parent f1738de commit d33e110

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
@@ -58,6 +58,15 @@ describe('DiffAnimationController', function () {
5858
assert.strictEqual(stats.activeCount, 0)
5959
}
6060

61+
// Helper function to setup animation and stop it
62+
async function setupAnimationAndStop(filePath: string, originalContent: string, newContent: string) {
63+
setupStandardMocks(originalContent)
64+
await controller.startDiffAnimation(filePath, originalContent, newContent, false)
65+
controller.stopDiffAnimation(filePath)
66+
const animationData = controller.getAnimationData(filePath)
67+
assert.strictEqual(animationData, undefined)
68+
}
69+
6170
beforeEach(function () {
6271
sandbox = sinon.createSandbox()
6372

@@ -265,17 +274,7 @@ describe('DiffAnimationController', function () {
265274

266275
describe('stopDiffAnimation', function () {
267276
it('should stop animation for specific file', async function () {
268-
const filePath = '/test/file.js'
269-
const originalContent = 'original'
270-
const newContent = 'new'
271-
272-
setupStandardMocks(originalContent)
273-
await controller.startDiffAnimation(filePath, originalContent, newContent, false)
274-
275-
controller.stopDiffAnimation(filePath)
276-
277-
const animationData = controller.getAnimationData(filePath)
278-
assert.strictEqual(animationData, undefined)
277+
await setupAnimationAndStop('/test/file.js', 'original', 'new')
279278
})
280279

281280
it('should handle stopping non-existent animation', function () {

0 commit comments

Comments
 (0)