Skip to content

Commit

Permalink
chore: wip
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisbbreuer committed Oct 17, 2024
1 parent f15f20c commit 75233fa
Showing 1 changed file with 75 additions and 7 deletions.
82 changes: 75 additions & 7 deletions test/dts.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,40 +11,108 @@ describe('dts-generation', () => {
const generatedDir = join(testDir, 'generated')

it('should properly generate types for example-1', async () => {
const example = 'example-1'

const config: DtsGenerationOption = {
file: join(__dirname, '..', 'tsconfig.json'),
file: join(inputDir, `${example}.ts`),
outdir: generatedDir,
clean: true,
tsconfigPath: join(__dirname, '..', 'tsconfig.json'),
}

await generate(config)

const example = 'example-1'
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 example-2', async () => {
await testExample('example-2')
const example = 'example-2'

const config: DtsGenerationOption = {
file: join(inputDir, `${example}.ts`),
outdir: generatedDir,
clean: true,
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 example-3', async () => {
await testExample('example-3')
const example = 'example-3'

const config: DtsGenerationOption = {
file: join(inputDir, `${example}.ts`),
outdir: generatedDir,
clean: true,
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 example-4', async () => {
await testExample('example-4')
const example = 'example-4'

const config: DtsGenerationOption = {
file: join(inputDir, `${example}.ts`),
outdir: generatedDir,
clean: true,
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 example-5', async () => {
await testExample('example-5')
const example = 'example-5'

const config: DtsGenerationOption = {
file: join(inputDir, `${example}.ts`),
outdir: generatedDir,
clean: true,
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 () => {
Expand Down

0 comments on commit 75233fa

Please sign in to comment.