toTsx.test.js — astro Source File
Architecture documentation for toTsx.test.js, a javascript file in the astro codebase. 3 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 38640847_f16f_1aaf_7eea_1ca5f5b21077["toTsx.test.js"] 1c7de883_cbe6_b630_d3b4_eccc425f8864["../dist/editor.cjs"] 38640847_f16f_1aaf_7eea_1ca5f5b21077 --> 1c7de883_cbe6_b630_d3b4_eccc425f8864 e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607["strict"] 38640847_f16f_1aaf_7eea_1ca5f5b21077 --> e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607 6b0635f9_51ea_77aa_767b_7857878e98a6["node:test"] 38640847_f16f_1aaf_7eea_1ca5f5b21077 --> 6b0635f9_51ea_77aa_767b_7857878e98a6 style 38640847_f16f_1aaf_7eea_1ca5f5b21077 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
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 = `
<template>
<div>{{ msg }}</div>
</template>
<script setup>
// This is a comment in script setup
// defineProps(['msg']);
// console.log('foo)
</script>
`;
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: import('@astrojs/vue/vue-shims.d.ts').PropsWithHTMLAttributes<Record<string, any>>): any {}`,
);
});
it('should correctly transform Vue code to TSX', () => {
const vueCode = `
<template>
<div @click="handleClick">{{ msg }}</div>
</template>
<script setup>
const props defineProps({
msg: String
});
const handleClick = () => {
console.log('foo');
}
</script>
`;
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:import('@astrojs/vue/vue-shims.d.ts').PropsWithHTMLAttributes<typeofProps>):any{<div></div>}`,
);
});
});
Domain
Dependencies
- ../dist/editor.cjs
- node:test
- strict
Source
Frequently Asked Questions
What does toTsx.test.js do?
toTsx.test.js is a source file in the astro codebase, written in javascript. It belongs to the CoreAstro domain.
What does toTsx.test.js depend on?
toTsx.test.js imports 3 module(s): ../dist/editor.cjs, node:test, strict.
Where is toTsx.test.js in the architecture?
toTsx.test.js is located at packages/integrations/vue/test/toTsx.test.js (domain: CoreAstro, directory: packages/integrations/vue/test).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free