Bump deps (incl. isomorphic-fetch replacement) (#2614)
* Bump deps (incl. isomorphic-fetch replacement) * Bump ts
This commit is contained in:
@@ -4,8 +4,7 @@
|
||||
|
||||
import { ProviderInterface, ProviderInterfaceCallback, ProviderInterfaceEmitted, ProviderInterfaceEmitCb } from '../types';
|
||||
|
||||
import './polyfill';
|
||||
|
||||
import fetch from 'cross-fetch';
|
||||
import { assert, logger } from '@polkadot/util';
|
||||
|
||||
import Coder from '../coder';
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
// Copyright 2017-2020 @polkadot/rpc-provider authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { Global } from './../mock/types';
|
||||
|
||||
declare const global: Global;
|
||||
|
||||
describe('http/polyfill', (): void => {
|
||||
let origFetch: any;
|
||||
|
||||
beforeEach((): void => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
||||
origFetch = global.fetch;
|
||||
});
|
||||
|
||||
afterEach((): void => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
||||
global.fetch = origFetch;
|
||||
});
|
||||
|
||||
it('polyfills with no exceptions (without fetch)', (): void => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
||||
(global as any).fetch = undefined;
|
||||
require('./polyfill');
|
||||
|
||||
expect(global.fetch).toBeDefined();
|
||||
});
|
||||
|
||||
it('polyfills with no exceptions (with fetch)', (): void => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
||||
(global as any).fetch = (): boolean => true;
|
||||
require('./polyfill');
|
||||
|
||||
expect(global.fetch).toBeDefined();
|
||||
});
|
||||
});
|
||||
@@ -1,7 +0,0 @@
|
||||
// Copyright 2017-2020 @polkadot/rpc-provider authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
if (typeof fetch === 'undefined') {
|
||||
require('isomorphic-fetch');
|
||||
}
|
||||
Reference in New Issue
Block a user