level_0
int64
0
10k
index
int64
0
0
repo_id
stringlengths
22
152
file_path
stringlengths
41
203
content
stringlengths
11
11.5M
6,699
0
petrpan-code/midwayjs/midway/packages/core/test/decorator
petrpan-code/midwayjs/midway/packages/core/test/decorator/annotation/objectDef.test.ts
import { Destroy, getObjectDefinition, Init, Scope, ScopeEnum, Singleton } from '../../../src'; class Parent {} @Scope(ScopeEnum.Prototype) class Test extends Parent { @Init() async abcde() {} @Destroy() destroy() {} } @Scope(ScopeEnum.Singleton) class TestOne {} @Scope(ScopeEnum.Request, { allowDowngrade:...
6,700
0
petrpan-code/midwayjs/midway/packages/core/test/decorator
petrpan-code/midwayjs/midway/packages/core/test/decorator/annotation/pipeline.test.ts
import { Pipeline, Provide, INJECT_CUSTOM_PROPERTY, getClassMetadata, } from '../../../src'; @Provide() class Test { @Pipeline() dd: any; } describe('/test/annotation/pipeline.test.ts', () => { it('pipeline decorator should be ok', () => { let data = getClassMetadata(INJECT_CUSTOM_PROPERTY, Test); ...
6,701
0
petrpan-code/midwayjs/midway/packages/core/test/decorator
petrpan-code/midwayjs/midway/packages/core/test/decorator/annotation/provide.test.ts
import { Provide, getProviderId, isProvide } from '../../../src'; @Provide('jjj') class Test {} describe('/test/annotation/provide.test.ts', () => { it('provide decorator should be ok', () => { const id = getProviderId(Test); expect(id).toEqual('jjj'); expect(isProvide(Test)).toBeTruthy(); }); });
6,702
0
petrpan-code/midwayjs/midway/packages/core/test/decorator
petrpan-code/midwayjs/midway/packages/core/test/decorator/annotation/schedule.test.ts
import { Schedule, getObjectDefinition, ScopeEnum, listModule, SCHEDULE_KEY, getClassMetadata, } from '../../../src'; @Schedule({ type: 'worker', interval: 2333, }) class Test {} describe('/test/annotation/schedule.test.ts', () => { it('schedule decorator should be ok', () => { const def = getOb...
6,703
0
petrpan-code/midwayjs/midway/packages/core/test/decorator
petrpan-code/midwayjs/midway/packages/core/test/decorator/annotation/task.test.ts
import { Task, TaskLocal, getClassMetadata, Queue, FORMAT, MODULE_TASK_METADATA, MODULE_TASK_TASK_LOCAL_OPTIONS, MODULE_TASK_QUEUE_OPTIONS, } from '../../../src'; @Queue() export class HelloTask { async execute(params){ console.log(params); } } class CustomFramework { @Task({ repeat: { ...
6,704
0
petrpan-code/midwayjs/midway/packages/core/test/decorator/annotation
petrpan-code/midwayjs/midway/packages/core/test/decorator/annotation/__snapshots__/filter.test.ts.snap
// Jest Snapshot v1, https://goo.gl/fbAQLP exports[`/test/annotation/filter.test.ts should test catch global 1`] = ` { "catchOptions": {}, "catchTargets": undefined, } `; exports[`/test/annotation/filter.test.ts test catch decorator 1`] = ` { "catchOptions": {}, "catchTargets": [ [Function], ], } `; ex...
6,705
0
petrpan-code/midwayjs/midway/packages/core/test/decorator/annotation
petrpan-code/midwayjs/midway/packages/core/test/decorator/annotation/__snapshots__/framework.test.ts.snap
// Jest Snapshot v1, https://goo.gl/fbAQLP exports[`/test/annotation/framework.test.ts test framework decorator 1`] = ` { "scope": "Singleton", } `;
6,706
0
petrpan-code/midwayjs/midway/packages/core/test/decorator/annotation
petrpan-code/midwayjs/midway/packages/core/test/decorator/annotation/__snapshots__/middleware.test.ts.snap
// Jest Snapshot v1, https://goo.gl/fbAQLP exports[`/test/annotation/middleware.test.ts test middleware decorator 1`] = ` { "scope": "Singleton", } `;
6,707
0
petrpan-code/midwayjs/midway/packages/core/test/decorator/annotation
petrpan-code/midwayjs/midway/packages/core/test/decorator/annotation/__snapshots__/pipeline.test.ts.snap
// Jest Snapshot v1, https://goo.gl/fbAQLP exports[`/test/annotation/pipeline.test.ts pipeline decorator should be ok 1`] = ` { "dd": { "impl": true, "key": "__pipeline_identifier__", "metadata": { "valves": undefined, }, "propertyName": "dd", }, } `;
6,708
0
petrpan-code/midwayjs/midway/packages/core/test/decorator/annotation
petrpan-code/midwayjs/midway/packages/core/test/decorator/annotation/__snapshots__/task.test.ts.snap
// Jest Snapshot v1, https://goo.gl/fbAQLP exports[`/test/annotation/task.test.ts test task decorator 1`] = ` [ { "name": "CustomFramework", "options": { "repeat": { "cron": "0 * * * * *", }, }, "propertyKey": "runTask", "value": [Function], }, ] `; exports[`/test/annotatio...
6,709
0
petrpan-code/midwayjs/midway/packages/core/test/decorator
petrpan-code/midwayjs/midway/packages/core/test/decorator/common/decoratorManager.test.ts
import { attachPropertyMetadata, clearAllModule, DecoratorManager, getClassMetadata, getObjectDefinition, getPropertyDataFromClass, getPropertyMetadata, getProviderId, listModule, listPreloadModule, listPropertyDataFromClass, PRELOAD_MODULE_KEY, resetModule, savePropertyDataToClass, getPro...
6,710
0
petrpan-code/midwayjs/midway/packages/core/test/decorator
petrpan-code/midwayjs/midway/packages/core/test/decorator/common/mock.test.ts
import { getObjectDefinition, ISimulation, Mock, ScopeEnum } from '../../../src'; describe('test/mock.test.ts', () => { it('should test mock decorator', function () { @Mock() class TestMock implements ISimulation { enableCondition() { return process.env.NODE_ENV === 'local'; } app...
6,711
0
petrpan-code/midwayjs/midway/packages/core/test/decorator
petrpan-code/midwayjs/midway/packages/core/test/decorator/common/pipe.test.ts
import { getObjectDefinition, Pipe } from '../../../src'; describe('test/pipe.test.ts', () => { @Pipe() class TestPipe {} it('should test pipe decorator', function () { const meta = getObjectDefinition(TestPipe); expect(meta).toMatchSnapshot(); }); });
6,712
0
petrpan-code/midwayjs/midway/packages/core/test/decorator
petrpan-code/midwayjs/midway/packages/core/test/decorator/common/utils.test.ts
import { saveProviderId, getPropertyInject, Provide, Inject, savePropertyInject, saveObjectDefinition, getObjectDefinition, getProviderId, } from '../../../src'; @Provide() class Test { @Inject('@testpackage') hello: any; } class TestOne { constructor(h1: any, h2: any) { // ignore } } des...
6,713
0
petrpan-code/midwayjs/midway/packages/core/test/decorator/common
petrpan-code/midwayjs/midway/packages/core/test/decorator/common/__snapshots__/pipe.test.ts.snap
// Jest Snapshot v1, https://goo.gl/fbAQLP exports[`test/pipe.test.ts should test pipe decorator 1`] = ` { "scope": "Singleton", } `;
6,714
0
petrpan-code/midwayjs/midway/packages/core/test/decorator
petrpan-code/midwayjs/midway/packages/core/test/decorator/faas/fun.test.ts
import { FUNC_KEY, Provide, getClassMetadata, listModule, ServerlessFunction, ServerlessTrigger, ServerlessTriggerType, } from '../../../src'; @Provide() class TestFun1 { @ServerlessFunction({ functionName: 'abcde' }) @ServerlessTrigger(ServerlessTriggerType.HTTP, { method: 'get', path: '/' }) ...
6,715
0
petrpan-code/midwayjs/midway/packages/core/test/decorator/faas
petrpan-code/midwayjs/midway/packages/core/test/decorator/faas/__snapshots__/fun.test.ts.snap
// Jest Snapshot v1, https://goo.gl/fbAQLP exports[`/test/faas/fun.test.ts fun decorator should be ok 1`] = ` [ { "metadata": {}, "methodName": "invoke", "type": "customTrigger", }, { "metadata": { "type": "every", "value": "5m", }, "methodName": "invoke", "type": "timer",...
6,718
0
petrpan-code/midwayjs/midway/packages/core/test/decorator
petrpan-code/midwayjs/midway/packages/core/test/decorator/framework/app.test.ts
import { App, getClassMetadata, INJECT_CUSTOM_PROPERTY, ApplicationContext, } from '../../../src'; class Test { @App() hhh: any; @ApplicationContext() container: any; } describe('/test/framework/app.test.ts', () => { it('app decorator should be ok', () => { let data = getClassMetadata(INJECT_CU...
6,719
0
petrpan-code/midwayjs/midway/packages/core/test/decorator
petrpan-code/midwayjs/midway/packages/core/test/decorator/framework/config.test.ts
import { Config, getClassMetadata, INJECT_CUSTOM_PROPERTY, } from '../../../src'; class Test { @Config() hhh: any; @Config('bbb') bbb: any; } describe('/test/framework/config.test.ts', () => { it('config decorator should be ok', () => { let data = getClassMetadata(INJECT_CUSTOM_PROPERTY, Test); ...
6,720
0
petrpan-code/midwayjs/midway/packages/core/test/decorator
petrpan-code/midwayjs/midway/packages/core/test/decorator/framework/logger.test.ts
import { Logger, getClassMetadata, INJECT_CUSTOM_PROPERTY, } from '../../../src'; class Test { @Logger() logger: any; @Logger('bbb') bbb: any; } describe('/test/framework/logger.test.ts', () => { it('logger decorator should be ok', () => { let data = getClassMetadata(INJECT_CUSTOM_PROPERTY, Test)...
6,721
0
petrpan-code/midwayjs/midway/packages/core/test/decorator
petrpan-code/midwayjs/midway/packages/core/test/decorator/framework/plugin.test.ts
import { getClassMetadata, Plugin, INJECT_CUSTOM_PROPERTY } from '../../../src'; class Test { @Plugin() test: any; @Plugin('bbb') bbb: any; } describe('/test/framework/plugin.test.ts', () => { it('plugin decorator should be ok', () => { let data = getClassMetadata(INJECT_CUSTOM_PROPERTY, Test); ...
6,722
0
petrpan-code/midwayjs/midway/packages/core/test/decorator/framework
petrpan-code/midwayjs/midway/packages/core/test/decorator/framework/__snapshots__/app.test.ts.snap
// Jest Snapshot v1, https://goo.gl/fbAQLP exports[`/test/framework/app.test.ts app decorator should be ok 1`] = ` { "container": { "impl": true, "key": "__midway_application_context__", "metadata": {}, "propertyName": "container", }, "hhh": { "impl": true, "key": "__midway_framework_app_...
6,723
0
petrpan-code/midwayjs/midway/packages/core/test/decorator/framework
petrpan-code/midwayjs/midway/packages/core/test/decorator/framework/__snapshots__/config.test.ts.snap
// Jest Snapshot v1, https://goo.gl/fbAQLP exports[`/test/framework/config.test.ts config decorator should be ok 1`] = ` { "bbb": { "impl": true, "key": "config", "metadata": { "identifier": "bbb", }, "propertyName": "bbb", }, "hhh": { "impl": true, "key": "config", "metadat...
6,724
0
petrpan-code/midwayjs/midway/packages/core/test/decorator/framework
petrpan-code/midwayjs/midway/packages/core/test/decorator/framework/__snapshots__/logger.test.ts.snap
// Jest Snapshot v1, https://goo.gl/fbAQLP exports[`/test/framework/logger.test.ts logger decorator should be ok 1`] = ` { "bbb": { "impl": true, "key": "logger", "metadata": { "identifier": "bbb", }, "propertyName": "bbb", }, "logger": { "impl": true, "key": "logger", "meta...
6,725
0
petrpan-code/midwayjs/midway/packages/core/test/decorator/framework
petrpan-code/midwayjs/midway/packages/core/test/decorator/framework/__snapshots__/plugin.test.ts.snap
// Jest Snapshot v1, https://goo.gl/fbAQLP exports[`/test/framework/plugin.test.ts plugin decorator should be ok 1`] = ` { "bbb": { "impl": true, "key": "plugin", "metadata": { "identifier": "bbb", }, "propertyName": "bbb", }, "test": { "impl": true, "key": "plugin", "metada...
6,726
0
petrpan-code/midwayjs/midway/packages/core/test/decorator
petrpan-code/midwayjs/midway/packages/core/test/decorator/microservice/consumer.test.ts
import { Consumer, getClassMetadata, getObjectDefinition, listModule, MS_CONSUMER_KEY, MSListenerType, ScopeEnum, } from '../../../src'; @Consumer(MSListenerType.RABBITMQ) class TestFun {} @Consumer(MSListenerType.MQTT) class TestFun1 {} describe('/test/microservice/consumer.test.ts', () => { it('tes...
6,727
0
petrpan-code/midwayjs/midway/packages/core/test/decorator
petrpan-code/midwayjs/midway/packages/core/test/decorator/microservice/kafka.test.ts
import { Consumer, getClassMetadata, getPropertyDataFromClass, MS_CONSUMER_KEY, MSListenerType, KafkaListener, } from '../../../src'; @Consumer(MSListenerType.KAFKA) class TestFun { @KafkaListener('tasks') async gotEvent() { } } describe('/test/microservice/kafka.test.ts', () => { it('test kafka ...
6,728
0
petrpan-code/midwayjs/midway/packages/core/test/decorator
petrpan-code/midwayjs/midway/packages/core/test/decorator/microservice/provider.test.ts
import { getClassMetadata, getObjectDefinition, listModule, MS_PROVIDER_KEY, ScopeEnum, MSProviderType, Provider, GRPCMetadata, GrpcMethod, DubboMethod, } from '../../../src'; @Provider(MSProviderType.GRPC, { package: 'test' }) class TestFun { @GrpcMethod() async invoke() {} } @Provider(MSProv...
6,729
0
petrpan-code/midwayjs/midway/packages/core/test/decorator
petrpan-code/midwayjs/midway/packages/core/test/decorator/microservice/rabbit.test.ts
import { Consumer, getClassMetadata, getPropertyDataFromClass, MS_CONSUMER_KEY, MSListenerType, RabbitMQListener, } from '../../../src'; @Consumer(MSListenerType.RABBITMQ) class TestFun { @RabbitMQListener('tasks') async gotEvent() { } } describe('/test/microservice/rabbit.test.ts', () => { it('t...
6,730
0
petrpan-code/midwayjs/midway/packages/core/test/decorator
petrpan-code/midwayjs/midway/packages/core/test/decorator/rpc/hsf.test.ts
import { HSF, listModule, HSF_KEY, getClassMetadata, getObjectDefinition, ScopeEnum, } from '../../../src'; @HSF({ version: '1.0.0', interfaceName: 'com.test.ttt.123', group: 'ttt', namespace: 'nnn', }) class TestFun {} @HSF() class TestFun1 {} describe('/test/rpc/hsf.test.ts', () => { it('hsf ...
6,731
0
petrpan-code/midwayjs/midway/packages/core/test/decorator
petrpan-code/midwayjs/midway/packages/core/test/decorator/util/camelCase.test.ts
import { Utils } from '../../../src'; describe('test/util/camelCase.test.ts', () => { it('camelCase', () => { expect(Utils.camelCase('foo-BAR')).toEqual('fooBar'); expect(Utils.camelCase('Foo-BAR')).toEqual('fooBar'); expect(Utils.camelCase('fooBAR')).toEqual('fooBar'); expect(Utils.camelCase('fooBaR...
6,732
0
petrpan-code/midwayjs/midway/packages/core/test/decorator
petrpan-code/midwayjs/midway/packages/core/test/decorator/util/flatted.test.ts
import { Utils } from '../../../src/'; const { safeStringify, safeParse } = Utils; describe('/test/util/flatted.test.ts', function () { it('should test base stringify', function () { expect(safeStringify([null, null])).toEqual('[[null,null]]'); var a = []; var o = {} as any; expect(safeStringify(a)...
6,733
0
petrpan-code/midwayjs/midway/packages/core/test/decorator
petrpan-code/midwayjs/midway/packages/core/test/decorator/util/format.test.ts
import { FORMAT } from '../../../src' describe('/test/util/format.test.ts', function () { it('should test MS constants', function () { expect(FORMAT.MS.ONE_SECOND).toEqual(1000); expect(FORMAT.MS.ONE_MINUTE).toEqual(60000); expect(FORMAT.MS.ONE_HOUR).toEqual(3600000); expect(FORMAT.MS.ONE_DAY).toEqua...
6,734
0
petrpan-code/midwayjs/midway/packages/core/test/decorator
petrpan-code/midwayjs/midway/packages/core/test/decorator/util/fs.test.ts
import { FileUtils } from '../../../src' import { join } from 'path'; describe('/test/util/fs.test.ts', function () { it('should test MS constants', async () => { expect(await FileUtils.exists(__dirname)).toBeTruthy(); expect(await FileUtils.exists(join(__dirname, '.tmp'))).toBeFalsy(); }); });
6,735
0
petrpan-code/midwayjs/midway/packages/core/test/decorator
petrpan-code/midwayjs/midway/packages/core/test/decorator/util/index.test.ts
import { Types, Utils } from '../../../src'; describe('/test/util/index.test.ts', () => { it('should test util method', async () => { expect(Types.isAsyncFunction(async () => {})).toBeTruthy(); expect(Types.isClass(class A {})).toBeTruthy(); expect(Types.isFunction(() => {})).toBeTruthy(); expect(Typ...
6,736
0
petrpan-code/midwayjs/midway/packages/core/test/decorator
petrpan-code/midwayjs/midway/packages/core/test/decorator/util/uuid.test.ts
import { Utils } from '../../../src'; import * as assert from 'assert'; describe('test/util/uuid.test.ts', () => { it('subsequent UUIDs are different', () => { const id1 = Utils.randomUUID(); const id2 = Utils.randomUUID(); assert(id1 !== id2); const id3 = Utils.randomUUID(true); const id4 = Ut...
6,737
0
petrpan-code/midwayjs/midway/packages/core/test/decorator/util
petrpan-code/midwayjs/midway/packages/core/test/decorator/util/__snapshots__/format.test.ts.snap
// Jest Snapshot v1, https://goo.gl/fbAQLP exports[`/test/util/format.test.ts should test crontab 1`] = ` { "EVERY_DAY": "0 0 0 * * *", "EVERY_DAY_ONE_FIFTEEN": "0 15 1 * * *", "EVERY_DAY_ZERO_FIFTEEN": "0 15 0 * * *", "EVERY_HOUR": "0 0 * * * *", "EVERY_MINUTE": "0 * * * * *", "EVERY_PER_10_MINUTE": "0 */...
6,738
0
petrpan-code/midwayjs/midway/packages/core/test/decorator
petrpan-code/midwayjs/midway/packages/core/test/decorator/web/controller.test.ts
import { Controller, CONTROLLER_KEY, listModule, getClassMetadata, getObjectDefinition, } from '../../../src'; import { ControllerOne, ControllerTwo, } from '../fixtures/decorator/customClass'; import { ScopeEnum } from '../../../src'; @Controller('/hhh', { sensitive: true, middleware: ['hello'], d...
6,739
0
petrpan-code/midwayjs/midway/packages/core/test/decorator
petrpan-code/midwayjs/midway/packages/core/test/decorator/web/paramMapping.test.ts
import { ALL, Body, createRequestParamDecorator, File, Files, getClassMetadata, Headers, INJECT_CUSTOM_PARAM, Param, Pipe, PipeTransform, Query, Session, } from '../../../src'; @Pipe() export class TestPipe implements PipeTransform { transform(value: any) { return value; } } @Pipe() ...
6,740
0
petrpan-code/midwayjs/midway/packages/core/test/decorator
petrpan-code/midwayjs/midway/packages/core/test/decorator/web/requestMapping.test.ts
import { Get, Post, Options, Head, All, getClassMetadata, WEB_ROUTER_KEY, RequestMapping, } from '../../../src'; class Test { @Get('/get', { routerName: 'get', middleware: ['hello'] }) async doGet() { // ignore } @Post('/get', { routerName: 'post', middleware: ['hello'], summary: 'test pos...
6,741
0
petrpan-code/midwayjs/midway/packages/core/test/decorator
petrpan-code/midwayjs/midway/packages/core/test/decorator/web/response.test.ts
import { ContentType, createRender, getPropertyMetadata, HttpCode, Redirect, SetHeader, WEB_RESPONSE_CONTENT_TYPE, WEB_RESPONSE_HEADER, WEB_RESPONSE_HTTP_CODE, WEB_RESPONSE_KEY, WEB_RESPONSE_REDIRECT, WEB_RESPONSE_RENDER } from '../../../src'; describe('/test/web/response.test.ts', function () ...
6,742
0
petrpan-code/midwayjs/midway/packages/core/test/decorator/web
petrpan-code/midwayjs/midway/packages/core/test/decorator/web/__snapshots__/paramMapping.test.ts.snap
// Jest Snapshot v1, https://goo.gl/fbAQLP exports[`/test/web/paramMapping.test.ts paramMapping decorator should be ok 1`] = ` { "doget": [ { "key": "web:router_param", "metadata": { "propertyData": [Function], "type": "custom", }, "options": { "impl": true, ...
6,743
0
petrpan-code/midwayjs/midway/packages/core/test/decorator/web
petrpan-code/midwayjs/midway/packages/core/test/decorator/web/__snapshots__/requestMapping.test.ts.snap
// Jest Snapshot v1, https://goo.gl/fbAQLP exports[`/test/web/requestMapping.test.ts requestMapping decorator should be ok 1`] = ` [ { "description": "", "ignoreGlobalPrefix": false, "method": "doGet", "middleware": [ "hello", ], "path": "/get", "requestMethod": "get", "routerNa...
6,744
0
petrpan-code/midwayjs/midway/packages/core/test/decorator
petrpan-code/midwayjs/midway/packages/core/test/decorator/ws/event.test.ts
import { WSEmit, getClassMetadata, OnWSConnection, OnWSDisConnection, OnWSMessage, WS_EVENT_KEY, WSController, WSEventTypeEnum } from '../../../src'; @WSController('bbb') class TestFun { @OnWSConnection() init() { } @OnWSMessage('my') @WSEmit('ok') async gotMyMessage(payload) { return ...
6,745
0
petrpan-code/midwayjs/midway/packages/core/test/decorator
petrpan-code/midwayjs/midway/packages/core/test/decorator/ws/wscontroller.test.ts
import { getClassMetadata, getObjectDefinition, listModule, ScopeEnum, WS_CONTROLLER_KEY, WSController } from '../../../src'; @WSController('bbb') class TestFun { } describe('/test/ws/wsController.test.ts', function () { it('test ws controller decorator', () => { const meta = getClassMetadata(WS_CONTROLLER_KEY,...
6,746
0
petrpan-code/midwayjs/midway/packages/core/test
petrpan-code/midwayjs/midway/packages/core/test/definitions/functionDefinition.test.ts
import { FunctionDefinition } from '../../src/definitions/functionDefinition'; import { ScopeEnum } from '../../src'; import sinon = require('sinon'); describe('/test/definitions/functionDefinition.test.ts', () => { it('function definition should be ok', async () => { const fun = new FunctionDefinition(); f...
6,747
0
petrpan-code/midwayjs/midway/packages/core/test
petrpan-code/midwayjs/midway/packages/core/test/definitions/objectCreator.test.ts
import { ObjectCreator } from '../../src/definitions/objectCreator'; import { ObjectDefinition } from '../../src/definitions/objectDefinition'; import path = require('path'); import sinon = require('sinon'); describe('/test/definitions/objectCreator.test.ts', () => { it('object creator should be ok', async () => { ...
6,748
0
petrpan-code/midwayjs/midway/packages/core/test
petrpan-code/midwayjs/midway/packages/core/test/definitions/objectDefinition.test.ts
import { ObjectDefinition } from '../../src/definitions/objectDefinition'; import { ScopeEnum } from '../../src'; describe('/test/definitions/objectDefinition.test.ts', () => { it('definition should be ok', () => { const definition = new ObjectDefinition(); expect(definition.isAsync()).toBeFalsy(); defin...
6,749
0
petrpan-code/midwayjs/midway/packages/core/test
petrpan-code/midwayjs/midway/packages/core/test/definitions/properties.test.ts
import { ObjectProperties } from '../../src/definitions/properties'; describe('/test/definitions/properties.test.ts', () => { it('#ObjectProperties test object config ok', () => { const config = new ObjectProperties(); config.set('aa', 1); config.set('bb', 2); config.set('cc', 'hello world'); co...
6,750
0
petrpan-code/midwayjs/midway/packages/core/test
petrpan-code/midwayjs/midway/packages/core/test/error/error.test.ts
import { MidwayError, MidwayHttpError, registerErrorCode } from '../../src'; describe('/test/error/error.test.ts', function () { it('should test base error', function () { expect(() => { throw new MidwayError('custom error'); }).toThrowError(MidwayError); }); it('should test error cause', function...
6,751
0
petrpan-code/midwayjs/midway/packages/core/test
petrpan-code/midwayjs/midway/packages/core/test/error/framework.test.ts
import { FrameworkErrorEnum, MidwayConfigMissingError, MidwayFeatureNoLongerSupportedError, MidwayFeatureNotImplementedError, MidwayInconsistentVersionError, MidwayInvokeForbiddenError, MidwayResolverMissingError } from '../../src'; describe('/test/error/framework.test.ts', function () { it('should test Midw...
6,752
0
petrpan-code/midwayjs/midway/packages/core/test
petrpan-code/midwayjs/midway/packages/core/test/error/http.test.ts
import { httpError } from '../../src'; describe('test/error/http.test.ts', function () { it('should test throw http error', function () { expect(() => { throw new httpError.BadRequestError(); }).toThrowError(httpError.BadRequestError); expect(() => { throw new httpError.UnauthorizedError(); ...
6,753
0
petrpan-code/midwayjs/midway/packages/core/test
petrpan-code/midwayjs/midway/packages/core/test/features/pipeline.test.ts
import bindClass, { DataMainTest } from '../fixtures/pipeline'; import { createLightFramework } from '../util'; describe('/test/features/pipeline.test.ts', () => { it('pipeline should be ok', async () => { const framework = await createLightFramework(); const container = framework.getApplicationContext(); ...
6,959
0
petrpan-code/midwayjs/midway/packages/core/test/fixtures/base-app-config-async-load/src
petrpan-code/midwayjs/midway/packages/core/test/fixtures/base-app-config-async-load/src/config/config.unittest.ts
exports.hello = { b: 4, c: 3, };
6,963
0
petrpan-code/midwayjs/midway/packages/core/test/fixtures/base-app-config-filter/src
petrpan-code/midwayjs/midway/packages/core/test/fixtures/base-app-config-filter/src/config/config.unittest.ts
exports.hello = { b: 4, c: 3, };
6,967
0
petrpan-code/midwayjs/midway/packages/core/test/fixtures/base-app-config-object/src
petrpan-code/midwayjs/midway/packages/core/test/fixtures/base-app-config-object/src/config/config.unittest.ts
exports.hello = { b: 4, c: 3, };
6,971
0
petrpan-code/midwayjs/midway/packages/core/test/fixtures/base-app-config/src
petrpan-code/midwayjs/midway/packages/core/test/fixtures/base-app-config/src/config/config.unittest.ts
exports.hello = { b: 4, c: 3, };
6,980
0
petrpan-code/midwayjs/midway/packages/core/test/fixtures/base-app-constructor/src
petrpan-code/midwayjs/midway/packages/core/test/fixtures/base-app-constructor/src/config/config.unittest.ts
'use strict'; exports.hello = { b: 4, c: 3, };
6,990
0
petrpan-code/midwayjs/midway/packages/core/test/fixtures/base-app-controller/src
petrpan-code/midwayjs/midway/packages/core/test/fixtures/base-app-controller/src/config/config.unittest.ts
exports.hello = { b: 4, c: 3, };
7,003
0
petrpan-code/midwayjs/midway/packages/core/test/fixtures/base-app-decorator/src
petrpan-code/midwayjs/midway/packages/core/test/fixtures/base-app-decorator/src/config/config.unittest.ts
exports.hello = { b: 4, c: 3, };
7,015
0
petrpan-code/midwayjs/midway/packages/core/test/fixtures/base-app-forbindapp/src
petrpan-code/midwayjs/midway/packages/core/test/fixtures/base-app-forbindapp/src/config/config.unittest.ts
exports.hello = { b: 4, c: 3, };
7,025
0
petrpan-code/midwayjs/midway/packages/core/test/fixtures/base-app-func-router/src
petrpan-code/midwayjs/midway/packages/core/test/fixtures/base-app-func-router/src/config/config.unittest.ts
exports.hello = { b: 4, c: 3, };
7,034
0
petrpan-code/midwayjs/midway/packages/core/test/fixtures/base-app-function/src
petrpan-code/midwayjs/midway/packages/core/test/fixtures/base-app-function/src/config/config.unittest.ts
exports.hello = { b: 4, c: 3, };
7,069
0
petrpan-code/midwayjs/midway/packages/core/test/fixtures/base-app-utils/src
petrpan-code/midwayjs/midway/packages/core/test/fixtures/base-app-utils/src/config/config.unittest.ts
'use strict'; exports.hello = { b: 4, c: 3, };
7,074
0
petrpan-code/midwayjs/midway/packages/core/test/fixtures/base-app-with-filter/src
petrpan-code/midwayjs/midway/packages/core/test/fixtures/base-app-with-filter/src/config/config.unittest.ts
exports.hello = { b: 4, c: 3, };
7,079
0
petrpan-code/midwayjs/midway/packages/core/test/fixtures/base-app-with-guard/src
petrpan-code/midwayjs/midway/packages/core/test/fixtures/base-app-with-guard/src/config/config.unittest.ts
exports.hello = { b: 4, c: 3, };
7,084
0
petrpan-code/midwayjs/midway/packages/core/test/fixtures/base-app/src
petrpan-code/midwayjs/midway/packages/core/test/fixtures/base-app/src/config/config.unittest.ts
exports.hello = { b: 4, c: 3, };
7,093
0
petrpan-code/midwayjs/midway/packages/core/test/fixtures
petrpan-code/midwayjs/midway/packages/core/test/fixtures/config/config.test.ts
module.exports = null;
7,117
0
petrpan-code/midwayjs/midway/packages/core/test/fixtures
petrpan-code/midwayjs/midway/packages/core/test/fixtures/ts-app-inject/test.ts
import { Config, Provide } from '../../../src'; @Provide() export class TestCons { @Config() aa: any; ts = Date.now(); }
7,118
0
petrpan-code/midwayjs/midway/packages/core/test
petrpan-code/midwayjs/midway/packages/core/test/functional/configuration.test.ts
import { createConfiguration } from '../../src'; describe('test/functional/configuration.test.ts', function () { it('should test create functional configuration', function () { const options = { imports: [], importConfigs: {}, importObjects: {}, }; const configuration = createConfigura...
7,119
0
petrpan-code/midwayjs/midway/packages/core/test
petrpan-code/midwayjs/midway/packages/core/test/service/aspectService.test.ts
import * as assert from 'assert'; import { MidwayAspectService, MidwayContainer } from '../../src'; describe('/test/service/aspectService.test.ts', () => { it('aspect normal method and async method should be ok', async() => { class A { async invokeAsyncMethod() { return 'hello world'; } ...
7,120
0
petrpan-code/midwayjs/midway/packages/core/test
petrpan-code/midwayjs/midway/packages/core/test/service/configService.test.ts
import assert = require('assert'); import { resolve, join } from 'path'; import { MidwayContainer, MidwayConfigService, MidwayInformationService, MidwayEnvironmentService, MidwayInvalidConfigError } from '../../src'; import * as mm from 'mm'; async function createConfigService(): Promise<MidwayConfigService> { const...
7,121
0
petrpan-code/midwayjs/midway/packages/core/test
petrpan-code/midwayjs/midway/packages/core/test/service/decoratorService.test.ts
import { MidwayAspectService, MidwayContainer, MidwayDecoratorService, createCustomMethodDecorator, createCustomParamDecorator, JoinPoint, Provide, Pipe, PipeTransform } from '../../src'; describe('/test/service/decoratorService.test.ts', () => { it('method decorator change method return value shoul...
7,122
0
petrpan-code/midwayjs/midway/packages/core/test
petrpan-code/midwayjs/midway/packages/core/test/service/env.test.ts
import assert = require('assert'); import { MidwayEnvironmentService } from '../../src'; describe('/test/services/env.test.ts', () => { it('environmentService should be ok', () => { const midEnv = new MidwayEnvironmentService(); midEnv.setCurrentEnvironment('local1'); assert.equal(midEnv.getCurrentEnvir...
7,123
0
petrpan-code/midwayjs/midway/packages/core/test
petrpan-code/midwayjs/midway/packages/core/test/service/informationService.test.ts
import { join } from 'path'; import { MidwayInformationService, MidwayContainer } from '../../src'; import { getUserHome } from '../../src/util'; describe('/test/services/informationService.test.ts', () => { it('informationService should be ok', async() => { process.env.NODE_ENV = 'local'; const container = ...
7,124
0
petrpan-code/midwayjs/midway/packages/core/test
petrpan-code/midwayjs/midway/packages/core/test/service/loggerService.test.ts
import { LoggerFactory, MidwayConfigService, MidwayContainer, MidwayEnvironmentService, MidwayInformationService, MidwayLoggerService } from '../../src'; import { ILogger } from '@midwayjs/logger'; class MockLoggerFactory extends LoggerFactory<any, any> { maps = new Map(); close(loggerName: string | un...
7,125
0
petrpan-code/midwayjs/midway/packages/core/test
petrpan-code/midwayjs/midway/packages/core/test/service/middlewareService.test.ts
import { Provide, MidwayMiddlewareService, MidwayContainer, Init, IgnoreMatcher } from '../../src'; import * as assert from 'assert'; describe('/test/services/middlewareService.test.ts', () => { describe('test compose', () => { let middlewareService = null; beforeEach(async () => { const container =...
7,126
0
petrpan-code/midwayjs/midway/packages/core/test
petrpan-code/midwayjs/midway/packages/core/test/service/mockService.test.ts
import { createLightFramework } from '../util'; import * as path from 'path'; import { MidwayMockService, IMidwayApplication } from '../../src'; import { UserService } from '../fixtures/base-app-ctx-mock/src/configuration'; describe('/service/mockService.test.ts', () => { it('should test mock context', async () => ...
7,128
0
petrpan-code/midwayjs/midway/packages/core/test
petrpan-code/midwayjs/midway/packages/core/test/service/slsFunctionService.test.ts
import { createLightFramework, matchObjectPropertyInArray } from '../util'; import * as path from 'path'; import { MidwayServerlessFunctionService, ServerlessTriggerType } from '../../src'; describe('/test/service/slsFunction.test.ts', function () { it('should test dynamic add function', async () => { const mid...
7,129
0
petrpan-code/midwayjs/midway/packages/core/test
petrpan-code/midwayjs/midway/packages/core/test/service/webRouterService.test.ts
import { createLightFramework } from '../util'; import * as path from 'path'; import { MidwayContainer, MidwayWebRouterService, bindContainer, clearAllModule } from '../../src'; describe('/test/service/webRouterService.test.ts', function () { it('should test add router first', async () => { const collector = ne...
7,130
0
petrpan-code/midwayjs/midway/packages/core/test/service
petrpan-code/midwayjs/midway/packages/core/test/service/__snapshots__/slsFunctionService.test.ts.snap
// Jest Snapshot v1, https://goo.gl/fbAQLP exports[`/test/service/slsFunction.test.ts should test dynamic add function 1`] = ` [ { "_category": 2, "_level": 2, "_paramString": "", "_pureRouter": "/api/hello", "_weight": 2, "controllerId": "", "controllerMiddleware": [], "description":...
7,131
0
petrpan-code/midwayjs/midway/packages/core/test/service
petrpan-code/midwayjs/midway/packages/core/test/service/__snapshots__/webRouterService.test.ts.snap
// Jest Snapshot v1, https://goo.gl/fbAQLP exports[`/test/service/webRouterService.test.ts fix issue 2319 1`] = ` [ "/test/test/asd", "/test/asd", "/test/**", "/**", ] `; exports[`/test/service/webRouterService.test.ts should test add router first 1`] = ` [ { "_category": 2, "_level": 3, "_param...
7,134
0
petrpan-code/midwayjs/midway/packages/core/test/service/fixtures
petrpan-code/midwayjs/midway/packages/core/test/service/fixtures/compatible_production/config.unittest.ts
export default (appInfo) => { return { bbb: { data: 321, } } }
7,144
0
petrpan-code/midwayjs/midway/packages/core/test
petrpan-code/midwayjs/midway/packages/core/test/util/extend.test.ts
import { extend } from '../../src'; const str = 'me a test'; const integer = 10; const arr = [1, 'what', new Date(81, 8, 4)]; const date = new Date(81, 4, 13); const Foo = function () {}; const obj = { str: str, integer: integer, arr: arr, date: date, constructor: 'fake', isPrototypeOf: 'not a function',...
7,145
0
petrpan-code/midwayjs/midway/packages/core/test
petrpan-code/midwayjs/midway/packages/core/test/util/httpclient.test.ts
import { createHttpServer } from '../util'; import { HttpClient, makeHttpRequest } from '../../src'; describe('/test/util/httpclient.test.ts', function () { it('should test base http request', async () => { const manager = await createHttpServer(); const httpclient = new HttpClient(); const result = awa...
7,146
0
petrpan-code/midwayjs/midway/packages/core/test
petrpan-code/midwayjs/midway/packages/core/test/util/path-match.test.ts
import { pathMatching as match } from '../../src/'; import * as assert from 'assert'; describe('/test/util/path-matching.test.ts', () => { it('options.match and options.ignore both present should throw', () => { try { match({ ignore: '/api', match: '/dashboard' }); throw new Error('should not exec');...
7,147
0
petrpan-code/midwayjs/midway/packages/core/test
petrpan-code/midwayjs/midway/packages/core/test/util/pathToRegexp.test.ts
import { PathToRegexpUtil } from '../../src'; import * as util from 'util'; describe('/test/util/pathToRegexp.test.ts', () => { it('should test to regexp', function () { const keys = []; const regexp = PathToRegexpUtil.toRegexp('/foo/:bar', keys); expect(regexp).toEqual(/^\/foo(?:\/([^\/#\?]+?))[\/#\?]?...
7,148
0
petrpan-code/midwayjs/midway/packages/core/test
petrpan-code/midwayjs/midway/packages/core/test/util/retry.test.ts
import { MidwayRetryExceededMaxTimesError, retryWithAsync, retryWith, sleep } from '../../src'; describe('test/util/retry.test.ts', function () { class TestService { initData = 'hello'; invokeTimes = 0; async getUserAsync(name: string) { await sleep(10); if (this.invokeTimes < 2) { t...
7,149
0
petrpan-code/midwayjs/midway/packages/core/test
petrpan-code/midwayjs/midway/packages/core/test/util/util.test.ts
import * as assert from 'assert'; import { join } from 'path'; import { safeRequire, safelyGet, joinURLPath, delegateTargetPrototypeMethod, delegateTargetMethod, delegateTargetProperties, transformRequestObjectByType, isIncludeProperty, delegateTargetAllPrototypeMethod, loadModule, sleep, create...
7,150
0
petrpan-code/midwayjs/midway/packages/core/test/util
petrpan-code/midwayjs/midway/packages/core/test/util/__snapshots__/pathToRegexp.test.ts.snap
// Jest Snapshot v1, https://goo.gl/fbAQLP exports[`/test/util/pathToRegexp.test.ts should test match 1`] = ` { "index": 0, "params": { "id": "123", }, "path": "/user/123", } `; exports[`/test/util/pathToRegexp.test.ts should test match 2`] = `false`; exports[`/test/util/pathToRegexp.test.ts should test ...
7,170
0
petrpan-code/midwayjs/midway/packages/cos
petrpan-code/midwayjs/midway/packages/cos/test/index.test.ts
import { join } from 'path'; import { COSService } from '../src'; import { close, createLightApp } from '@midwayjs/mock'; if (process.env.GITHUB_JOB && !process.env.TENCENT_COS_SECRET_ID) { // pr 环境 describe('/test/index.test.ts', () => { it('should skip pr', function () { console.log('skip in pr'); ...
7,187
0
petrpan-code/midwayjs/midway/packages/cron
petrpan-code/midwayjs/midway/packages/cron/test/index.test.ts
import { createApp, close } from '@midwayjs/mock'; import { join } from 'path'; import { sleep } from '@midwayjs/core'; import * as cron from '../src'; describe(`/test/index.test.ts`, () => { it('test job with decorator and start', async () => { const app = await createApp(join(__dirname, 'fixtures', 'base-app')...
7,210
0
petrpan-code/midwayjs/midway/packages/cross-domain
petrpan-code/midwayjs/midway/packages/cross-domain/test/express.test.ts
import { createHttpRequest, close, createApp } from '@midwayjs/mock'; import { join } from 'path'; import * as assert from 'assert'; describe('test/express.test.ts', function () { let app; beforeAll(async () => { const appDir = join(__dirname, 'fixtures/express'); app = await createApp(appDir); }); aft...
7,211
0
petrpan-code/midwayjs/midway/packages/cross-domain
petrpan-code/midwayjs/midway/packages/cross-domain/test/faas.test.ts
import { createHttpRequest, close, createFunctionApp } from '@midwayjs/mock'; import { join } from 'path'; import { BootstrapStarter } from '../../../packages-serverless/midway-fc-starter/src'; import * as assert from 'assert'; describe('test/faas.test.ts', function () { let app; beforeAll(async () => { const a...
7,212
0
petrpan-code/midwayjs/midway/packages/cross-domain
petrpan-code/midwayjs/midway/packages/cross-domain/test/koa.test.ts
import { createHttpRequest, close, createApp } from '@midwayjs/mock'; import { join } from 'path'; import * as assert from 'assert'; describe('test/koa.test.ts', function () { let app; beforeAll(async () => { const appDir = join(__dirname, 'fixtures/koa'); try { app = await createApp(appDir); } ca...
7,224
0
petrpan-code/midwayjs/midway/packages/decorator
petrpan-code/midwayjs/midway/packages/decorator/test/decoratorManager.test.ts
import { getMethodParamTypes, Get } from '../src'; describe('/test/decoratorManager.test.ts', () => { it('should test', function () { const obj = {ccc: 'd'} class D {} class A { @Get() async invoke(a: number, b: string, c: boolean, d: D, e: [], f: Map<string, any>, g: Set<any>) {} @Ge...
7,225
0
petrpan-code/midwayjs/midway/packages/decorator
petrpan-code/midwayjs/midway/packages/decorator/test/index.test.ts
describe('test', () => { it('test decorator run', async () => { function ClassA(): ClassDecorator { return (target) => { console.log('A class decorator', target); } } function ClassB(): ClassDecorator { return (target) => { console.log('B class decorator', target); ...
7,226
0
petrpan-code/midwayjs/midway/packages/decorator/test
petrpan-code/midwayjs/midway/packages/decorator/test/annotation/aspect.test.ts
import { Aspect, ASPECT_KEY, IMethodAspect, JoinPoint, listModule } from '../../src'; describe('/test/annotation/aspect.test.ts', () => { it('test inspect key in module', () => { class MyAspect implements IMethodAspect { around(point: JoinPoint): any { point.proceed(); } } @Aspect(My...
7,227
0
petrpan-code/midwayjs/midway/packages/decorator/test
petrpan-code/midwayjs/midway/packages/decorator/test/annotation/autoload.test.ts
import { listPreloadModule, Autoload } from '../../src'; describe('/test/annotation/autoload.test.ts', () => { it('test preload key in module', () => { @Autoload() class LoadA { } @Autoload() class LoadB { } const modules = listPreloadModule(); expect(modules.length).toEqual(2); ...
7,228
0
petrpan-code/midwayjs/midway/packages/decorator/test
petrpan-code/midwayjs/midway/packages/decorator/test/annotation/configuration.test.ts
import { Configuration, getClassMetadata, CONFIGURATION_KEY } from '../../src'; @Configuration({ importConfigs: ['./config.default'], importObjects: { aa: { bb: 1 } }, imports: ['./nodes'], namespace: 'hello', detectorOptions: { a: 1 } }) class Test {} @Configuration() class TestOne {} describe('/tes...