import withDeprecationWarning from './index';
var deprecatedMessage = 'This is deprecated!';
var testObj = {
  notDeprecated: 'foo',
  deprecated: 'bar'
};
var deprecatedProperties = {
  deprecated: deprecatedMessage
};
describe('property that is not in deprecatedProperties', function () {
  test('does not warn in console', function () {
    var warn = jest.spyOn(console, 'warn');
    var subject = withDeprecationWarning(testObj, deprecatedProperties); // eslint-disable-next-line no-unused-expressions

    subject.notDeprecated;
    expect(warn).not.toHaveBeenCalled();
    warn.mockRestore();
  });
  test('returns the property value', function () {
    var subject = withDeprecationWarning(testObj, deprecatedProperties);
    var value = subject.notDeprecated;
    expect(value).toBe('foo');
  });
});
describe('property that is in deprecatedProperties', function () {
  test('warns in console', function () {
    var warn = jest.spyOn(console, 'warn');
    var subject = withDeprecationWarning(testObj, deprecatedProperties); // eslint-disable-next-line no-unused-expressions

    subject.deprecated;
    expect(warn).toHaveBeenCalledWith("[Deprecation Warning]: ".concat(deprecatedMessage));
    warn.mockRestore();
  });
  test('returns the property value', function () {
    var subject = withDeprecationWarning(testObj, deprecatedProperties);
    var value = subject.deprecated;
    expect(value).toBe('bar');
  });
});