{"size": 1442, "ext": "js", "max_stars_repo_path": "spec/utils/logger.test.js", "max_stars_repo_name": "albertosaito/auto-ops", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "spec/utils/logger.test.js", "max_issues_repo_name": "albertosaito/auto-ops", "max_issues_repo_issues_event_min_datetime": "2017-04-16T00:24:45.000Z", "max_issues_repo_issues_event_max_datetime": "2017-12-24T22:16:26.000Z", "max_forks_repo_path": "spec/utils/logger.test.js", "max_forks_repo_name": "albertosaito/auto-ops", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": 3, "max_forks_count": null, "avg_line_length": 41.2, "max_line_length": 147, "alphanum_fraction": 0.7330097087}
/* eslint-env jest */

const testSubject = require('../../lib/utils/logger')
const loggerConstants = require('../../lib/constants').LOGGER
const expectedWarnMessage = `${loggerConstants.BLACK}${loggerConstants.YELLOW_BG}BOOM${loggerConstants.RESET_CONSOLE_FORMAT}`
const expectedInfoMessage = `${loggerConstants.WHITE}${loggerConstants.BLUE_BG}BOOM${loggerConstants.RESET_CONSOLE_FORMAT}`
const expectedDebugMessage = `${loggerConstants.WHITE}${loggerConstants.GREEN_BG}BOOM${loggerConstants.RESET_CONSOLE_FORMAT}`
const expectedErrorMessage = `${loggerConstants.BLACK}${loggerConstants.RED_BG}${loggerConstants.BLINK}BOOM${loggerConstants.RESET_CONSOLE_FORMAT}`

describe('@logger Module', () => {
  beforeEach(() => {
    console.log = jest.fn()
  })

  test('#warn - Should be printed in black on yellow background', () => {
    testSubject.warn('BOOM')
    expect(console.log).toBeCalledWith(expectedWarnMessage)
  })

  test('#info - Should be printed in white on blue background', () => {
    testSubject.info('BOOM')
    expect(console.log).toBeCalledWith(expectedInfoMessage)
  })

  test('#debug - Should be printed in whitw on green background', () => {
    testSubject.debug('BOOM')
    expect(console.log).toBeCalledWith(expectedDebugMessage)
  })

  test('#error - Should be printed in blinking, black on red background', () => {
    testSubject.error('BOOM')
    expect(console.log).toBeCalledWith(expectedErrorMessage)
  })
})
