Skip to content

Commit

Permalink
wip: vue support test
Browse files Browse the repository at this point in the history
  • Loading branch information
Ilya Golovin committed Feb 18, 2024
1 parent 908a98b commit c079189
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions typescript/test/codeActions/addDestruct.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,52 @@ describe('Add destructure', () => {
})
})
})
describe.todo('Vue support', () => {
test('Should handle props reactivity lose', () => {
const initial = /* ts */ `
const /*t*/props/*t*/ = defineProps({
source: {
type: Object,
required: true,
},
});
`
const expected = /* ts */ `
const { source } = toRefs(defineProps({
source: {
type: Object,
required: true,
},
}));
`

const { codeAction } = fourslashLikeTester(initial, undefined, { dedent: true })

codeAction(0, {
refactorName: 'Add Destruct',
newContent: expected,
})
})
test('Should handle `reactive` object reactivity lose', () => {
const initial = /* ts */ `
const /*t*/reactiveObject/*t*/ = reactive({
source: 'str'
});
`
const expected = /* ts */ `
const { source } = toRefs(reactive({
source: 'str'
}));
`

const { codeAction } = fourslashLikeTester(initial, undefined, { dedent: true })

codeAction(0, {
refactorName: 'Add Destruct',
newContent: expected,
})
})
})

describe('Skip cases', () => {
test('Should skip if trying to destruct expression of call expression', () => {
Expand Down

0 comments on commit c079189

Please sign in to comment.