Remove Promise chain, fix formatting test subscription (#1218)
This commit is contained in:
@@ -42,7 +42,7 @@ function formattingTests (version: string, storage: Storage, encodedValues: [str
|
||||
: null
|
||||
)
|
||||
),
|
||||
subscribe: jest.fn((type, method, params, cb): void => {
|
||||
subscribe: jest.fn((type, method, params, cb): Promise<void> => {
|
||||
if (params[0][0] === CONTRACT_KEY) {
|
||||
// this emulates https://github.com/polkadot-js/api/issues/1051
|
||||
cb(null, {
|
||||
@@ -69,6 +69,8 @@ function formattingTests (version: string, storage: Storage, encodedValues: [str
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
return Promise.resolve();
|
||||
})
|
||||
};
|
||||
|
||||
|
||||
@@ -198,12 +198,9 @@ export default class Rpc implements RpcInterface {
|
||||
observer.next(this.formatOutput(method, params, result));
|
||||
};
|
||||
|
||||
// FIXME This is a work-around, provider.subscribe _should_ always return,
|
||||
// however in some cases `this.provider.subscribe.catch` yields ".catch of
|
||||
// undefined", so here we flatten via Promise.reolve (which doe sfollow)
|
||||
subscriptionPromise = Promise.resolve(
|
||||
this.provider.subscribe(subType, subName, paramsJson, update)
|
||||
).catch(errorHandler);
|
||||
subscriptionPromise = this.provider
|
||||
.subscribe(subType, subName, paramsJson, update)
|
||||
.catch(errorHandler);
|
||||
} catch (error) {
|
||||
errorHandler(error);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user