Skip to content

Commit

Permalink
tests: isProxySupported
Browse files Browse the repository at this point in the history
  • Loading branch information
ealush committed Mar 31, 2022
1 parent 9010c82 commit 38c7305
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions packages/n4s/src/lib/__tests__/isProxySupported.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import isProxySupported from 'isProxySupported';

describe('isProxySupported', () => {
describe('When proxy is supported', () => {
it('should return true', () => {
expect(isProxySupported()).toBe(true);
});
});

describe('When proxy is not supported', () => {
describe('When Proxy is undefined', () => {
beforeEach(() => {
Object.defineProperty(global, 'Proxy', {
value: undefined,
configurable: true,
});
});

it('should return false', () => {
expect(isProxySupported()).toBe(false);
});
});

describe('When proxy property does not exist on global object', () => {
beforeEach(() => {
// @ts-ignore
delete global.Proxy;
});

it('should return false', () => {
expect(isProxySupported()).toBe(false);
});
});
});
});

0 comments on commit 38c7305

Please sign in to comment.