本文整理匯總了TypeScript中@tg-resources/test-server.getHostUrl函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript getHostUrl函數的具體用法?TypeScript getHostUrl怎麽用?TypeScript getHostUrl使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了getHostUrl函數的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: test
test('Network error is triggered', async () => {
const res = new Resource('/', {
apiRoot: getHostUrl(2999),
});
await expectError(res.fetch(), { errorCls: NetworkError });
});
示例2: getHostUrl
import { FetchResource as Resource } from '@tg-resources/fetch';
import { expectedBuffer, getHostUrl, listen } from '@tg-resources/test-server';
import { Server } from 'http';
import 'jest-extended';
import { InvalidResponseCode, RequestValidationError } from 'tg-resources';
import { createSagaRouter, isSagaResource, isSagaResourceInitialized, SagaRequestConfig } from '../src';
import { configureStore } from './reduxStore';
import { addRequestConfig, createApi, expectError, expectResponse } from './utils';
const port = 3003;
const hostUrl = getHostUrl(port);
let server: Server;
let store: ReturnType<typeof configureStore>;
beforeEach(() => {
store = configureStore();
server = listen(port);
});
afterEach(() => {
server.close();
});
describe('createSagaRouter functional', () => {