Skip to content

Commit

Permalink
test: 💍 tsx conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
nivekcode committed Nov 14, 2023
1 parent 00348a9 commit 6a85dff
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/lib/generators/code-snippet-generators.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
generateNamedImportStatement,
generateObjectInterface,
generateSvgConstant,
generateTSXConstant,
generateTypeDefinition,
generateTypeHelper,
generateTypeHelperWithImport,
Expand Down Expand Up @@ -260,4 +261,13 @@ describe('Generators', () => {
expect(unformatedString(generatedStatement)).toEqual(unformatedString(expectedStatement));
});
});

describe('TSX', () => {
it('should convert a svg to a React component', () => {
const expected = `export const Smile = (props: {[key: string]: any}) => (<svg class="my-awesome-svg" {...props}></svg>);`;

const actual = generateTSXConstant('smile', '<svg class="my-awesome-svg"></svg>');
expect(actual).toEqual(expected);
});
});
});

0 comments on commit 6a85dff

Please sign in to comment.