Rebrand: polkadot → pezkuwi, substrate → bizinikiwi, kusama → dicle

This commit is contained in:
Kurdistan Tech Ministry committed 2026-01-07 02:29:40 +03:00
commit d5f038faea
1383 files changed
+1088018

No files matched your search

@@ -0,0 +1,35 @@
// Copyright 2017-2025 @pezkuwi/rpc-provider authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Mock } from './types.js';
import nock from 'nock';
interface Request {
code?: number;
method: string;
reply?: Record<string, unknown>;
}
interface HttpMock extends Mock {
post: (uri: string) => {
reply: (code: number, handler: (uri: string, body: { id: string }) => unknown) => HttpMock
}
}
export const TEST_HTTP_URL = 'http://localhost:9944';
export function mockHttp (requests: Request[]): Mock {
nock.cleanAll();
return requests.reduce((scope: HttpMock, request: Request) =>
scope
.post('/')
.reply(request.code || 200, (_uri: string, body: { id: string }) => {
scope.body = scope.body || {};
scope.body[request.method] = body;
return Object.assign({ id: body.id, jsonrpc: '2.0' }, request.reply || {}) as unknown;
}),
nock(TEST_HTTP_URL) as unknown as HttpMock);
}