Skip to content

Commit

Permalink
tests fixups
Browse files Browse the repository at this point in the history
  • Loading branch information
marcopiraccini committed Dec 5, 2023
1 parent 60c0109 commit 8be2ce8
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions test/main/prepare-folder.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -46,22 +46,21 @@ test('Install a non-existent template', async () => {
throw new Error('Should have thrown an error')
} catch (err) {
expect(err).toBeInstanceOf(Error)
expect(err.message).toContain('Command failed with exit code 1')
expect(logger.errors[0]).toEqual(['npm ERR! code E404'])
expect(err.message).toContain("Cannot find module '@platformatic/dontexist'")
}
})

test('Install one @platformatic/service template', async () => {
const appDir = await mkdtemp(join(tmpdir(), 'plat-app-test-create'))
await prepareFolder(appDir, ['@platformatic/service'], logger, 'test-app')
expect(logger.infos[0][0].name).toEqual('@platformatic/service')
expect(logger.infos[0][0].startsWith('Installing @platformatic/service')).toBe(true)
expect(logger.errors.length).toBe(0)
}, 30000)

test('Install one @platformatic/service template twice', async () => {
const appDir = await mkdtemp(join(tmpdir(), 'plat-app-test-create'))
await prepareFolder(appDir, ['@platformatic/service'], logger, 'test-app')
expect(logger.infos[0][0].name).toEqual('@platformatic/service')
expect(logger.infos[0][0].startsWith('Installing @platformatic/service')).toBe(true)
expect(logger.errors.length).toBe(0)

await prepareFolder(appDir, ['@platformatic/service'], logger, 'test-app')
Expand Down

0 comments on commit 8be2ce8

Please sign in to comment.