{"size": 1005, "ext": "js", "max_stars_repo_path": "test/package/development.js", "max_stars_repo_name": "pvmsikrsna/warning", "max_stars_repo_stars_event_min_datetime": "2016-06-05T04:03:57.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-02T01:07:31.000Z", "max_issues_repo_path": "test/package/development.js", "max_issues_repo_name": "pvmsikrsna/warning", "max_issues_repo_issues_event_min_datetime": "2016-09-03T15:37:16.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-27T21:16:47.000Z", "max_forks_repo_path": "test/package/development.js", "max_forks_repo_name": "pvmsikrsna/warning", "max_forks_repo_forks_event_min_datetime": "2016-07-20T20:11:29.000Z", "max_forks_repo_forks_event_max_datetime": "2022-01-08T04:29:15.000Z"}
{"max_stars_count": 203, "max_issues_count": 28, "max_forks_count": 38, "avg_line_length": 27.9166666667, "max_line_length": 85, "alphanum_fraction": 0.7004975124}
module.exports = function() {
  var warning = require('../../');

  expect(function() {
    warning(true);
  }).toThrow(/requires a warning/i);

  expect(function() {
    warning(false);
  }).toThrow(/requires a warning/i);

  var error = console.error;

  var mockFn = console.error = jest.fn();
  var calls = console.error.mock.calls;

  // should call console.error
  warning(false, 'warning message');

  // should not call console.error
  warning(true, 'warning message');

  expect(mockFn).toHaveBeenCalledTimes(1);
  expect(mockFn).toHaveBeenCalledWith('Warning: warning message');

  // should format message with arguments
  warning(false, 'warning %s with one argument', 'message');
  warning(false, 'warning %s with %s arguments', 'message', 'two');

  expect(mockFn).toHaveBeenCalledTimes(3);
  expect(mockFn).toHaveBeenCalledWith('Warning: warning message with one argument');
  expect(mockFn).toHaveBeenCalledWith('Warning: warning message with two arguments');

  console.error = error;
};
