mirror of
https://github.com/kremalicious/blog.git
synced 2025-01-09 13:18:54 +01:00
Add React component generation test to icon script
This commit is contained in:
parent
2ef64cf23d
commit
44baa27326
@ -9,7 +9,7 @@ afterAll(() => {
|
|||||||
fs.rm(path.resolve(__dirname, 'tmp'), { recursive: true })
|
fs.rm(path.resolve(__dirname, 'tmp'), { recursive: true })
|
||||||
})
|
})
|
||||||
|
|
||||||
test('should generate Astro components from SVG files', async () => {
|
test('should generate Astro & React components from SVG files', async () => {
|
||||||
// Act
|
// Act
|
||||||
await generateIcons(distDir)
|
await generateIcons(distDir)
|
||||||
|
|
||||||
@ -27,13 +27,22 @@ test('should generate Astro components from SVG files', async () => {
|
|||||||
throw new Error('Props.d.ts does not exist')
|
throw new Error('Props.d.ts does not exist')
|
||||||
}
|
}
|
||||||
|
|
||||||
// Assert: Check if an example Astro component exists
|
// Assert: Check if an example Astro & React component exists
|
||||||
const exampleComponentPath = path.join(distDir, 'Bitcoin.astro')
|
const exampleComponentPathAstro = path.join(distDir, 'Bitcoin.astro')
|
||||||
|
const exampleComponentPathReact = path.join(distDir, 'react', 'Bitcoin.tsx')
|
||||||
try {
|
try {
|
||||||
await fs.stat(exampleComponentPath)
|
await fs.stat(exampleComponentPathAstro)
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`Example Astro component does not exist: ${exampleComponentPath}`
|
`Example Astro component does not exist: ${exampleComponentPathAstro}`
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
await fs.stat(exampleComponentPathReact)
|
||||||
|
} catch (err) {
|
||||||
|
throw new Error(
|
||||||
|
`Example React component does not exist: ${exampleComponentPathReact}`
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user