2019-03-03 08:12:46 +00:00
|
|
|
import { consola } from '../utils'
|
2019-04-11 10:04:21 +00:00
|
|
|
import { showBanner } from '../../src/utils/banner'
|
2019-03-03 08:12:46 +00:00
|
|
|
|
|
|
|
jest.mock('std-env', () => ({
|
2021-11-03 17:46:49 +00:00
|
|
|
isTest: false,
|
|
|
|
isMinimal: true
|
2019-03-03 08:12:46 +00:00
|
|
|
}))
|
|
|
|
|
|
|
|
describe('cli/utils', () => {
|
|
|
|
afterEach(() => jest.resetAllMocks())
|
|
|
|
|
|
|
|
test('showBanner prints only listeners', () => {
|
|
|
|
const listeners = [
|
|
|
|
{ url: 'first' },
|
|
|
|
{ url: 'second' }
|
|
|
|
]
|
|
|
|
|
2019-04-11 10:04:21 +00:00
|
|
|
showBanner({
|
2019-03-03 08:12:46 +00:00
|
|
|
options: {
|
2019-09-30 08:46:58 +00:00
|
|
|
cli: {
|
|
|
|
bannerColor: 'green'
|
|
|
|
}
|
2019-03-03 08:12:46 +00:00
|
|
|
},
|
|
|
|
server: {
|
|
|
|
listeners
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
expect(consola.info).toHaveBeenCalledTimes(2)
|
|
|
|
expect(consola.info).toHaveBeenCalledWith(`Listening on: ${listeners[0].url}`)
|
|
|
|
expect(consola.info).toHaveBeenCalledWith(`Listening on: ${listeners[1].url}`)
|
|
|
|
})
|
|
|
|
})
|