/*global describe, it, expect*/
import {getKey, NonConformingError} from '../src';

describe('getKey', () => {
  it('gets key from a key-tagged value', () => {
    const obj = {
      'I am the key': 'value'
    };

    expect(getKey(obj)).toBe('I am the key');
  });

  it('gets key when the prototype is null', () => {
    const obj = Object.create(null);
    obj.theKey = 'value';

    expect(getKey(obj)).toBe('theKey');
  });


  it('gets key when the prototype is polluted', () => {
    const obj = Object.create({ theKey: 'Hello' });
    obj.theKey = 'the value';

    expect(getKey(obj)).toBe('theKey');
  });

  describe('NonConformingError', () => {
    it('fails when passed an empty object', () => {
      expect(() => {
        getKey({});
      }).toThrowError(NonConformingError);
    });

    it('fails when passed an object with too many properties', () => {
      expect(() => {
        getKey({oneKey: 'value', twoKey: 'value'});
      }).toThrowError(NonConformingError);
    });

    it('fails when empty and the prototype is polluted', () => {
      const obj = Object.create({
        theKey: 'value'
      });

      expect(() => {
        getKey(obj);
      }).toThrowError(NonConformingError);
    });
  });
});

@@ -1124,24 +1124,568 @@
 %0A      %7D);%0A%0A
+      expect(() =%3E %7B%0A        getKey(obj);%0A      %7D).toThrowError(NonConformingError);%0A    %7D);%0A%0A    it('fails when passed an object with no enumerable properties', () =%3E %7B%0A      let obj = Object.create(null, %7B%0A        theKey: %7B%0A          value: 'value',%0A          enumerable: false%0A        %7D%0A      %7D);%0A%0A      expect(() =%3E %7B%0A        getKey(obj);%0A      %7D).toThrowError(NonConformingError);%0A%0A      obj = %7B theKey: 'value' %7D;%0A      expect(getKey(obj)).toBe('theKey');%0A      Object.defineProperty(obj, 'theKey', %7B%0A        enumerable: false%0A      %7D);%0A%0A
       expect

Add spec for only checking enumerable properties.