const { OError, isOError, unwrapOError } = _private;

describe('OError (white box test)', () => {

  it('is exported as O.Error', () => {
    expect(OError).toBe(O.Error);
  });

});

describe('isOError (white box test)', () => {

  it('returns true for wrapped functional errors (anything besides undefined)', () => {
    [null, 0, 1, '', 'foo', '0', [], {}, () => {}].forEach(value => {
      const error = OError(value);
      expect(isOError(error)).toBe(true);
    });
  });

  it('returns false for everything else', () => {
    [undefined, null, {}, [], () => {}, 1, 0, Error(), new Error(), O, OError].forEach(other => {
      expect(isOError(other)).toBe(false);
    });
  });

});

describe('unwrapOError (white box test)', () => {

  it('extracts the value of a functional error', () => {
    [null, 0, 1, '', 'foo', '0', [], {}, () => {}].forEach(value => {
      const error = OError(value);
      expect(unwrapOError(error)).toBe(value);
    });
  });

});

@@ -384,37 +384,148 @@
  =%3E %7B%0A      
-const
+let error = OError(value);%0A      expect(isOError(error)).toBe(true);%0A      // Works also if created with %E2%80%98new%E2%80%99%0A     
  error =
  OError(valu
@@ -504,32 +504,36 @@
 w%E2%80%99%0A      error =
+ new
  OError(value);%0A
@@ -988,21 +988,137 @@
     
-const
+let error = OError(value);%0A      expect(unwrapOError(error)).toBe(value);%0A      // Works also if created with %E2%80%98new%E2%80%99%0A     
  error =
  OEr
@@ -1105,32 +1105,36 @@
 w%E2%80%99%0A      error =
+ new
  OError(value);%0A

Test functional error wrapping with ‘new’