Skip to content

Commit

Permalink
Merge pull request tailwindlabs#633 from tailwindcss/fix-cli-tests
Browse files Browse the repository at this point in the history
Return expectation promise in CLI test cases
  • Loading branch information
adamwathan authored Feb 1, 2019
2 parents d9b675e + d2faab5 commit df507ab
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions __tests__/cli.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,21 @@ describe('cli', () => {

describe('init', () => {
it('creates a Tailwind config file', () => {
cli(['init']).then(() => {
return cli(['init']).then(() => {
expect(utils.writeFile.mock.calls[0][0]).toEqual(constants.defaultConfigFile)
expect(utils.writeFile.mock.calls[0][1]).toContain('defaultConfig')
})
})

it('creates a Tailwind config file in a custom location', () => {
cli(['init', 'custom.js']).then(() => {
return cli(['init', 'custom.js']).then(() => {
expect(utils.writeFile.mock.calls[0][0]).toEqual('custom.js')
expect(utils.writeFile.mock.calls[0][1]).toContain('defaultConfig')
})
})

it('creates a Tailwind config file without comments', () => {
cli(['init', '--no-comments']).then(() => {
return cli(['init', '--no-comments']).then(() => {
expect(utils.writeFile.mock.calls[0][1]).not.toContain('/**')
expect(utils.writeFile.mock.calls[0][1]).toContain('//')
})
Expand All @@ -39,32 +39,32 @@ describe('cli', () => {

describe('build', () => {
it('compiles CSS file', () => {
cli(['build', inputCssPath]).then(() => {
return cli(['build', inputCssPath]).then(() => {
expect(process.stdout.write.mock.calls[0][0]).toContain('.example')
})
})

it('compiles CSS file using custom configuration', () => {
cli(['build', inputCssPath, '--config', customConfigPath]).then(() => {
return cli(['build', inputCssPath, '--config', customConfigPath]).then(() => {
expect(process.stdout.write.mock.calls[0][0]).toContain('400px')
})
})

it('creates compiled CSS file', () => {
cli(['build', inputCssPath, '--output', 'output.css']).then(() => {
return cli(['build', inputCssPath, '--output', 'output.css']).then(() => {
expect(utils.writeFile.mock.calls[0][0]).toEqual('output.css')
expect(utils.writeFile.mock.calls[0][1]).toContain('.example')
})
})

it('compiles CSS file with autoprefixer', () => {
cli(['build', inputCssPath]).then(() => {
return cli(['build', inputCssPath]).then(() => {
expect(process.stdout.write.mock.calls[0][0]).toContain('-ms-input-placeholder')
})
})

it('compiles CSS file without autoprefixer', () => {
cli(['build', inputCssPath, '--no-autoprefixer']).then(() => {
return cli(['build', inputCssPath, '--no-autoprefixer']).then(() => {
expect(process.stdout.write.mock.calls[0][0]).not.toContain('-ms-input-placeholder')
})
})
Expand Down

0 comments on commit df507ab

Please sign in to comment.