test: update
This commit is contained in:
parent
e161ec546d
commit
32ab678017
12
packages/cli/test/fixtures/transform-sfc/app.vue
vendored
Normal file
12
packages/cli/test/fixtures/transform-sfc/app.vue
vendored
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
<script lang="ts" setup>
|
||||
const array: (number | string)[] = [1, 2, 3]
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div v-bind="{ array }">
|
||||
template
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
</style>
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
||||
|
||||
exports[`transformSFC > basic 1`] = `
|
||||
"<script setup>
|
||||
const array = [1, 2, 3];
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div v-bind=\\"{ array }\\">template</div>
|
||||
</template>
|
||||
|
||||
<style scoped></style>
|
||||
"
|
||||
`;
|
||||
18
packages/cli/test/utils/transform-sfc.test.ts
Normal file
18
packages/cli/test/utils/transform-sfc.test.ts
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
import { readFileSync } from 'node:fs'
|
||||
import { resolve } from 'node:path'
|
||||
import { describe, expect, test } from 'vitest'
|
||||
import { transformSFC } from '../../src/utils/transformers/transform-sfc'
|
||||
|
||||
describe('transformSFC', () => {
|
||||
const appVuePath = resolve(__dirname, '../fixtures/transform-sfc/app.vue')
|
||||
const content = readFileSync(appVuePath, 'utf-8')
|
||||
test('basic', async () => {
|
||||
const result = await transformSFC({
|
||||
name: 'app.vue',
|
||||
content,
|
||||
}, {
|
||||
typescript: false,
|
||||
} as any)
|
||||
expect(result).toMatchSnapshot()
|
||||
})
|
||||
})
|
||||
Loading…
Reference in New Issue
Block a user