Skip to content

Commit

Permalink
chore: add example test 4 & 5
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisbbreuer committed Nov 9, 2024
1 parent 3df7622 commit 73d0659
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions test/dts.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,48 @@ describe('dts-generation', () => {
expect(generatedContent).toBe(expectedContent)
})

it('should properly generate types for type example/0004', async () => {
const example = '0004'

const config: DtsGenerationOption = {
entrypoints: [join(inputDir, `example/${example}.ts`)],
outdir: generatedDir,
clean: false,
tsconfigPath: join(__dirname, '..', 'tsconfig.json'),
}

await generate(config)

const outputPath = join(outputDir, `${example}.d.ts`)
const generatedPath = join(generatedDir, `${example}.d.ts`)

const expectedContent = await Bun.file(outputPath).text()
const generatedContent = await Bun.file(generatedPath).text()

expect(generatedContent).toBe(expectedContent)
})

it('should properly generate types for type example/0005', async () => {
const example = '0005'

const config: DtsGenerationOption = {
entrypoints: [join(inputDir, `example/${example}.ts`)],
outdir: generatedDir,
clean: false,
tsconfigPath: join(__dirname, '..', 'tsconfig.json'),
}

await generate(config)

const outputPath = join(outputDir, `${example}.d.ts`)
const generatedPath = join(generatedDir, `${example}.d.ts`)

const expectedContent = await Bun.file(outputPath).text()
const generatedContent = await Bun.file(generatedPath).text()

expect(generatedContent).toBe(expectedContent)
})

afterEach(async () => {
// Clean up generated files
try {
Expand Down

0 comments on commit 73d0659

Please sign in to comment.