本文整理汇总了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', () => {