From e586d7d704d475afe3373a1de6ae20d504f79d6d Mon Sep 17 00:00:00 2001
From: "github-actions[bot]"
<41898282+github-actions[bot]@users.noreply.github.com>
Date: Thu, 5 Jun 2025 14:25:23 +0000
Subject: Sync from a8e1c0a7402940e0fc5beef669522b315052df1b
---
packages/integrations/vue/test/toTsx.test.js | 51 ++++++++++++++++++++++++++++
1 file changed, 51 insertions(+)
create mode 100644 packages/integrations/vue/test/toTsx.test.js
(limited to 'packages/integrations/vue/test/toTsx.test.js')
diff --git a/packages/integrations/vue/test/toTsx.test.js b/packages/integrations/vue/test/toTsx.test.js
new file mode 100644
index 000000000..b91b5cad1
--- /dev/null
+++ b/packages/integrations/vue/test/toTsx.test.js
@@ -0,0 +1,51 @@
+import assert from 'node:assert/strict';
+import { describe, it } from 'node:test';
+import { toTSX } from '../dist/editor.cjs';
+
+describe('toTSX function', () => {
+ it('should correctly transform Vue code to TSX with comments', () => {
+ const vueCode = `
+
+ {{ msg }}
+
+
+
+ `;
+
+ const className = 'MyComponent';
+ const result = toTSX(vueCode, className);
+
+ // Replace the expectations below with the expected result based on your logic
+ assert.strictEqual(
+ result,
+ `export default function ${className}__AstroComponent_(_props: Record): any {}`,
+ );
+ });
+ it('should correctly transform Vue code to TSX', () => {
+ const vueCode = `
+
+ {{ msg }}
+
+
+
+ `;
+
+ const className = 'MyComponent';
+ const result = toTSX(vueCode, className);
+ assert.strictEqual(
+ result.replace(/\s/g, ''),
+ `import{defineProps}from'vue';constProps=defineProps({msg:String})exportdefaultfunction${className}__AstroComponent_(_props:typeofProps):any{}`,
+ );
+ });
+});
--
cgit v1.2.3