diff --git a/react/__tests__/useCssHandles.test.tsx b/react/__tests__/useCssHandles.test.tsx index 665d965..5661130 100644 --- a/react/__tests__/useCssHandles.test.tsx +++ b/react/__tests__/useCssHandles.test.tsx @@ -70,5 +70,24 @@ describe('useCssHandles', () => { 'vtex-app-2-x-element2 vtex-app-2-x-element2--blockClass vtex-previous-app-2-x-element2 vtex-previous-app-2-x-element2--blockClass vtex-previous-app-3-x-element2 vtex-previous-app-3-x-element2--blockClass', }) }) + + it('doesnt repeat the migration if the current app happens to be the same as the migration one', () => { + const CSS_HANDLES = ['element1', 'element2'] + + const handles = useCssHandles(CSS_HANDLES, { + migrationFrom: [ + 'vtex.previous-app@2.0.0', + 'vtex.previous-app@3.0.0', + 'vtex.app@2.1.0', + ], + }) + + expect(handles).toStrictEqual({ + element1: + 'vtex-app-2-x-element1 vtex-app-2-x-element1--blockClass vtex-previous-app-2-x-element1 vtex-previous-app-2-x-element1--blockClass vtex-previous-app-3-x-element1 vtex-previous-app-3-x-element1--blockClass', + element2: + 'vtex-app-2-x-element2 vtex-app-2-x-element2--blockClass vtex-previous-app-2-x-element2 vtex-previous-app-2-x-element2--blockClass vtex-previous-app-3-x-element2 vtex-previous-app-3-x-element2--blockClass', + }) + }) }) })