level_0 int64 0 10k | index int64 0 0 | repo_id stringlengths 22 152 | file_path stringlengths 41 203 | content stringlengths 11 11.5M |
|---|---|---|---|---|
5,218 | 0 | petrpan-code/nhost/nhost/packages/hasura-auth-js | petrpan-code/nhost/nhost/packages/hasura-auth-js/tests/utils.jsdom.test.ts | /**
* @vitest-environment jsdom
*/
import { expect, test, suite, assert, vi } from 'vitest'
import { removeParameterFromWindow } from '../src'
suite('removeParameterFromWindow', () => {
test('removes the specified parameter from the URL', () => {
// Create a mock window object and assign it to the global wind... |
5,219 | 0 | petrpan-code/nhost/nhost/packages/hasura-auth-js | petrpan-code/nhost/nhost/packages/hasura-auth-js/tests/utils.test.ts | import { expect, test, suite, assert, vi } from 'vitest'
import {
encodeQueryParameters,
getParameterByName,
isValidEmail,
isValidPassword,
RedirectOption,
rewriteRedirectTo
} from '../src'
suite('encodeQueryParameters', () => {
test('returns the baseUrl if no parameters are given', () => {
assert(en... |
5,319 | 0 | petrpan-code/nhost/nhost/packages/hasura-storage-js/src/utils | petrpan-code/nhost/nhost/packages/hasura-storage-js/src/utils/appendImageTransformationParameters/appendImageTransformationParameters.test.ts | import { expect, test } from 'vitest'
import appendImageTransformationParameters from './appendImageTransformationParameters'
test('should append image transformation parameters to a simple URL', () => {
expect(
appendImageTransformationParameters('https://example.com', {
width: 100,
height: 100,
... |
5,322 | 0 | petrpan-code/nhost/nhost/packages/hasura-storage-js | petrpan-code/nhost/nhost/packages/hasura-storage-js/tests/access-token.test.ts | import { describe, it } from 'vitest'
import { storage } from './utils/helpers'
describe('test access token', () => {
it('should be able to set access token', async () => {
const ACCESS_TOKEN = 'my-access-token'
storage.setAccessToken(ACCESS_TOKEN)
})
it('should be able to set admin secret', async () =... |
5,323 | 0 | petrpan-code/nhost/nhost/packages/hasura-storage-js | petrpan-code/nhost/nhost/packages/hasura-storage-js/tests/convert-filename.test.ts | import { describe, expect, it } from 'vitest'
import { toIso88591 } from '../src/utils/upload'
describe('test file names', () => {
it('should be able to use ISO 8859-1 strings', async () => {
expect(toIso88591('a 你 好')).toMatchInlineSnapshot('"a%20%E4%BD%A0%20%E5%A5%BD"')
expect(toIso88591('abcÂÃ')).toMatchI... |
5,324 | 0 | petrpan-code/nhost/nhost/packages/hasura-storage-js | petrpan-code/nhost/nhost/packages/hasura-storage-js/tests/delete.test.ts | import fs from 'fs'
import { v4 as uuidv4 } from 'uuid'
import { describe, expect, it } from 'vitest'
import { storage } from './utils/helpers'
describe('test delete file', () => {
it('should be able to get delete file', async () => {
const file = fs.createReadStream('./tests/assets/sample.pdf')
const { fi... |
5,325 | 0 | petrpan-code/nhost/nhost/packages/hasura-storage-js | petrpan-code/nhost/nhost/packages/hasura-storage-js/tests/get-presigned-url.test.ts | import FormData from 'form-data'
import fs from 'fs'
import { v4 as uuidv4 } from 'uuid'
import { describe, expect, it } from 'vitest'
import { storage } from './utils/helpers'
describe('test get presigned url of file', () => {
it('should be able to get presigned url of file', async () => {
const formData = new ... |
5,326 | 0 | petrpan-code/nhost/nhost/packages/hasura-storage-js | petrpan-code/nhost/nhost/packages/hasura-storage-js/tests/get.test.ts | import FormData from 'form-data'
import fs from 'fs'
import { v4 as uuidv4 } from 'uuid'
import { describe, expect, it } from 'vitest'
import { storage } from './utils/helpers'
describe('test get file', () => {
it('should be able to get uploaded file', async () => {
const fd = new FormData()
fd.append('file'... |
5,327 | 0 | petrpan-code/nhost/nhost/packages/hasura-storage-js | petrpan-code/nhost/nhost/packages/hasura-storage-js/tests/image-transformation.test.ts | import FormData from 'form-data'
import fs from 'fs'
import jpeg from 'jpeg-js'
import pixelmatch from 'pixelmatch'
import { beforeAll, describe, expect, it } from 'vitest'
import { storage } from './utils/helpers'
const downloadJpeg = async (url: string) =>
jpeg.decode(Buffer.from(await fetch(url).then((res) => res... |
5,328 | 0 | petrpan-code/nhost/nhost/packages/hasura-storage-js | petrpan-code/nhost/nhost/packages/hasura-storage-js/tests/upload.test.ts | import fetchPonyfill from 'fetch-ponyfill'
import FormData from 'form-data'
import fs from 'fs'
import { v4 as uuidv4 } from 'uuid'
import { describe, expect, it } from 'vitest'
import { storage } from './utils/helpers'
const { fetch } = fetchPonyfill()
describe('test upload', () => {
it('should upload a file from ... |
5,329 | 0 | petrpan-code/nhost/nhost/packages/hasura-storage-js | petrpan-code/nhost/nhost/packages/hasura-storage-js/tests/utils.test.ts | import { describe, expect, it } from 'vitest'
import { appendImageTransformationParameters, StorageImageTransformationParams } from '../src/utils'
describe('appendImageTransformationParameters', () => {
it('appends image transformation parameters to the url', () => {
const url = 'https://example.com/image.jpg'
... |
5,343 | 0 | petrpan-code/nhost/nhost/packages/nextjs | petrpan-code/nhost/nhost/packages/nextjs/tests/main.test.ts | import { describe, expect, it } from 'vitest'
describe('tests', () => {
it('should have more tests', () => {
expect(true).toBeTruthy()
})
})
|
5,444 | 0 | petrpan-code/nhost/nhost/packages/nhost-js | petrpan-code/nhost/nhost/packages/nhost-js/tests/functions.test.ts | import { describe, it, expect, afterEach, beforeEach } from 'vitest'
import { urlFromSubdomain } from '../src/utils/helpers'
import { createFunctionsClient, NhostFunctionsClient } from '../src/clients/functions'
describe('createFunctionsClient', () => {
it('should throw an error if neither subdomain nor functionsUrl... |
5,445 | 0 | petrpan-code/nhost/nhost/packages/nhost-js | petrpan-code/nhost/nhost/packages/nhost-js/tests/nhost.test.ts | import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'
import { createNhostClient } from '../src'
const cloud = 'goiqxsyjxufxlprgiprm'
const local = 'localhost'
describe('NhostClient', () => {
describe('being used with Nhost Cloud', () => {
const nhostCloud = createNhostClient({ subdomain: clo... |
5,446 | 0 | petrpan-code/nhost/nhost/packages/nhost-js | petrpan-code/nhost/nhost/packages/nhost-js/tests/utils.test.ts | import { describe, expect, it } from 'vitest'
import { buildUrl, LOCALHOST_REGEX, urlFromSubdomain } from '../src/utils/helpers'
describe('urlFromParams', () => {
describe('when using backendUrl', () => {
it('should return the full url with the path "/v1/auth" concatenated', async () => {
const url = urlFr... |
5,496 | 0 | petrpan-code/nhost/nhost/packages/react | petrpan-code/nhost/nhost/packages/react/tests/main.test.ts | import { describe, expect, it } from 'vitest'
describe('tests', () => {
it('should have more tests', () => {
expect(true).toBeTruthy()
})
})
|
5,546 | 0 | petrpan-code/nhost/nhost/packages/vue | petrpan-code/nhost/nhost/packages/vue/tests/main.test.ts | import { ref } from 'vue'
import { nestedUnref } from '../src/helpers'
describe('nestedUnref', () => {
it('should unref ref values in a unref property', async () => {
const a = ref('value of a')
const b = ref('value of b')
const input = { metadata: { a, b } }
const result = nestedUnref(input)
expe... |
5,564 | 0 | petrpan-code/Vanessa219/vditor/__test__ | petrpan-code/Vanessa219/vditor/__test__/markdown/lute.test.ts | import {spec} from "./commonmark-0.29";
require("../../src/js/lute/lute.min.js");
const globalAny: any = global;
it("MarkdownIt", () => {
spec.forEach(async (item: any) => {
const lute = globalAny.Lute.New();
lute.SetGFMAutoLink(false);
lute.SetGFMStrikethrough(false);
lute.SetGFM... |
5,566 | 0 | petrpan-code/Vanessa219/vditor/__test__ | petrpan-code/Vanessa219/vditor/__test__/util/Options.test.ts | const globalAny: any = global;
globalAny.VDITOR_VERSION = "version";
import {Options} from "../../src/ts/util/Options";
describe("Options", () => {
const cache = {
enable: true,
id: "vditorTest",
};
test("Options toolbar", () => {
const options = new Options({
cache,
... |
5,891 | 0 | petrpan-code/midwayjs/midway/packages-legacy/egg-layer/test/fixtures/midway-fc/src | petrpan-code/midwayjs/midway/packages-legacy/egg-layer/test/fixtures/midway-fc/src/config/config.unittest.ts |
exports.hello = {
b: 4,
c: 3,
};
|
5,939 | 0 | petrpan-code/midwayjs/midway/packages-legacy/orm | petrpan-code/midwayjs/midway/packages-legacy/orm/test/index.test.ts | import { join } from 'path';
import { existsSync, unlinkSync } from 'fs';
import { close, createLightApp } from '@midwayjs/mock';
import { IMidwayApplication } from '@midwayjs/core';
describe('/test/index.test.ts', () => {
it.skip('should use one db', async () => {
cleanFile(join(__dirname, 'fixtures/base-fn', '... |
5,974 | 0 | petrpan-code/midwayjs/midway/packages-legacy/runtime-engine | petrpan-code/midwayjs/midway/packages-legacy/runtime-engine/test/index.test.ts | import path = require('path');
import { BaseRuntimeEngine, Runtime, ServerlessBaseRuntime } from '../src';
import { exec } from 'child_process';
import * as assert from 'assert';
import { testExtension } from './fixtures/base';
import { HttpEvent } from './fixtures/extension/httpEvent';
import { TestRuntime } from './T... |
5,975 | 0 | petrpan-code/midwayjs/midway/packages-legacy/runtime-engine | petrpan-code/midwayjs/midway/packages-legacy/runtime-engine/test/layer.test.ts | describe('/test/layer.test.ts', () => {
it('test layer', () => {
})
});
|
5,976 | 0 | petrpan-code/midwayjs/midway/packages-legacy/runtime-engine | petrpan-code/midwayjs/midway/packages-legacy/runtime-engine/test/perf-events.test.ts | import { BaseRuntimeEngine } from '../src';
import * as assert from 'assert';
import * as perfHooks from 'perf_hooks';
import * as path from 'path';
describe('/test/perf-events.test.ts', () => {
beforeAll(() => {
// 设置函数执行目录
process.env.ENTRY_DIR = path.join(__dirname, './fixtures/common');
});
it('shou... |
5,977 | 0 | petrpan-code/midwayjs/midway/packages-legacy/runtime-engine | petrpan-code/midwayjs/midway/packages-legacy/runtime-engine/test/runtime-error.test.ts | import { RuntimeError } from '..';
import * as assert from 'assert';
describe('runtime-error', () => {
it('create new error', () => {
try {
throw new RuntimeError('init fail');
} catch (e) {
assert.equal(e.name, 'RuntimeError');
assert.equal(e.message, 'init fail');
}
});
it('creat... |
5,978 | 0 | petrpan-code/midwayjs/midway/packages-legacy/runtime-engine | petrpan-code/midwayjs/midway/packages-legacy/runtime-engine/test/runtime-events.test.ts | import { BaseRuntimeEngine } from '../src';
import * as assert from 'assert';
import * as path from 'path';
const events = [
'beforeRuntimeStart',
'afterRuntimeStart',
'beforeFunctionStart',
'afterFunctionStart',
'beforeInvoke',
'afterInvoke',
'beforeClose',
];
describe('/test/runtime-events.test.ts', (... |
5,979 | 0 | petrpan-code/midwayjs/midway/packages-legacy/runtime-engine | petrpan-code/midwayjs/midway/packages-legacy/runtime-engine/test/runtime.test.ts | import * as mm from 'mm';
import { ServerlessBaseRuntime } from '../src';
describe('/test/runtime.test.ts', function () {
it('should test env and get function name and service name', function () {
mm(process.env, 'MIDWAY_SERVERLESS_FUNCTION_NAME', 'ccc');
mm(process.env, 'MIDWAY_SERVERLESS_SERVICE_NAME', ... |
5,980 | 0 | petrpan-code/midwayjs/midway/packages-legacy/runtime-engine | petrpan-code/midwayjs/midway/packages-legacy/runtime-engine/test/util.test.ts | import { completeAssign } from '../src/util';
import * as assert from 'assert';
describe('/test/util.test.ts', () => {
it('test assign', () => {
let a = 2;
const data = completeAssign(
{},
{
afterTest() {
a = 1;
},
a: 1,
beforeGo: 1,
},
{
... |
5,988 | 0 | petrpan-code/midwayjs/midway/packages-legacy/runtime-engine/test | petrpan-code/midwayjs/midway/packages-legacy/runtime-engine/test/lib/parser.test.ts | import assert = require('assert');
import { EnvPropertyParser } from '../../src/lib/parser';
describe('parser.test.ts', () => {
it('should test getProperty', () => {
const parser = new EnvPropertyParser();
const path = parser.getProperty('path');
assert(path);
});
it('should test setProperty', () =>... |
5,998 | 0 | petrpan-code/midwayjs/midway/packages-legacy/runtime-mock | petrpan-code/midwayjs/midway/packages-legacy/runtime-mock/test/index.test.ts | import { createRuntime, HTTPEvent } from '../src';
import { join } from 'path';
describe('/test/index.test.ts', () => {
it('should create runtime', async () => {
let initHandlerResult;
const runtime = createRuntime({
functionDir: join(__dirname, './code'),
events: [new HTTPEvent()],
initHan... |
6,015 | 0 | petrpan-code/midwayjs/midway/packages-legacy/serverless-app | petrpan-code/midwayjs/midway/packages-legacy/serverless-app/test/faas-start-end.test.ts | import { join } from 'path';
import * as assert from 'assert';
import { existsSync, remove } from 'fs-extra';
import { close } from '@midwayjs/mock';
import { Framework } from '../src';
import { createInitializeContext } from '../../serverless-fc-trigger';
import { FC } from '@midwayjs/faas-typings';
import { createFun... |
6,016 | 0 | petrpan-code/midwayjs/midway/packages-legacy/serverless-app | petrpan-code/midwayjs/midway/packages-legacy/serverless-app/test/faas-v2.test.ts | import { join } from 'path';
import * as assert from 'assert';
import { close, createHttpRequest } from '@midwayjs/mock';
import { Framework, Application } from '../src';
import { EventService } from './fixtures/faas-v2/src/event';
import { createInitializeContext, createTimerEvent } from '../../serverless-fc-trigger';... |
6,017 | 0 | petrpan-code/midwayjs/midway/packages-legacy/serverless-app | petrpan-code/midwayjs/midway/packages-legacy/serverless-app/test/intergration-v2.test.ts | import { join } from 'path';
import * as assert from 'assert';
import { close } from '@midwayjs/mock';
import { createFunctionApp } from './util';
const request = require('supertest');
const cwd = join(__dirname, 'fixtures/integration-v2');
describe('test/index.test.ts', () => {
let app;
beforeAll(async () => {
... |
6,051 | 0 | petrpan-code/midwayjs/midway/packages-legacy/serverless-aws-starter | petrpan-code/midwayjs/midway/packages-legacy/serverless-aws-starter/test/index.test.ts | import * as assert from 'assert';
import { asyncWrapper, start } from '../src';
import { AWSBasicHTTPEvent } from '../src/interface';
import * as mm from 'mm';
class Tester {
handler;
constructor(handler) {
this.handler = handler;
}
async runHttp(event: AWSBasicHTTPEvent, context = {}) {
const args =... |
6,052 | 0 | petrpan-code/midwayjs/midway/packages-legacy/serverless-aws-starter/test | petrpan-code/midwayjs/midway/packages-legacy/serverless-aws-starter/test/__snapshots__/index.test.ts.snap | // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`/test/index.test.ts wrapper web event should ok with asyncWrap when error 1`] = `
{
"body": "Internal Server Error",
"headers": {},
"isBase64Encoded": false,
"statusCode": 500,
}
`;
exports[`/test/index.test.ts wrapper web event should ok with error 1`] = `
... |
6,062 | 0 | petrpan-code/midwayjs/midway/packages-legacy/serverless-fc-starter | petrpan-code/midwayjs/midway/packages-legacy/serverless-fc-starter/test/index.test.ts | import { createRuntime } from '@midwayjs/runtime-mock';
import * as assert from 'assert';
import * as events from 'events';
import { asyncWrapper, start } from '../src';
import * as mm from 'mm';
// 这里不能用包引,会循环依赖
import {
HTTPTrigger,
ApiGatewayTrigger,
} from '../../serverless-fc-trigger/src';
import { join } from... |
6,084 | 0 | petrpan-code/midwayjs/midway/packages-legacy/serverless-fc-trigger | petrpan-code/midwayjs/midway/packages-legacy/serverless-fc-trigger/test/index.test.ts | import { createRuntime } from '@midwayjs/runtime-mock';
import { join } from 'path';
import {
ApiGatewayTrigger,
CDNTrigger,
HTTPTrigger,
OSSTrigger,
SLSTrigger,
TimerTrigger,
FCBaseTrigger,
} from '../src';
import * as assert from 'assert';
import * as request from 'supertest';
describe('/test/index.tes... |
6,101 | 0 | petrpan-code/midwayjs/midway/packages-legacy/serverless-scf-starter | petrpan-code/midwayjs/midway/packages-legacy/serverless-scf-starter/test/index.test.ts | import * as assert from 'assert';
import { asyncWrapper, start } from '../src';
import * as mm from 'mm';
class Tester {
handler;
constructor(handler) {
this.handler = handler;
}
async runHttp(event, context = {}) {
const args = [
Object.assign({}, require('../resource/event'), event),
c... |
6,114 | 0 | petrpan-code/midwayjs/midway/packages-legacy/serverless-scf-trigger | petrpan-code/midwayjs/midway/packages-legacy/serverless-scf-trigger/test/index.test.ts | import { createRuntime } from '@midwayjs/runtime-mock';
import { join } from 'path';
import { ApiGatewayTrigger, COSTrigger, TimerTrigger } from '../src';
import * as assert from 'assert';
import { CMQTrigger } from '../src/cmq';
import { CKafkaTrigger } from '../src/ckafka';
describe('/test/index.test.ts', () => {
... |
6,128 | 0 | petrpan-code/midwayjs/midway/packages-legacy/serverless-vercel-starter | petrpan-code/midwayjs/midway/packages-legacy/serverless-vercel-starter/test/index.test.ts | import { createRuntime } from '@midwayjs/runtime-mock';
import * as assert from 'assert';
// 这里不能用包引,会循环依赖
import { HTTPTrigger } from '../../serverless-vercel-trigger/src';
import { join } from 'path';
describe('/test/index.test.ts', () => {
it('should invoke normal code', async () => {
const runtime = createRu... |
6,137 | 0 | petrpan-code/midwayjs/midway/packages-legacy/serverless-vercel-trigger | petrpan-code/midwayjs/midway/packages-legacy/serverless-vercel-trigger/test/index.test.ts | import { createRuntime } from '@midwayjs/runtime-mock';
import * as assert from 'assert';
// 这里不能用包引,会循环依赖
import { HTTPTrigger } from '../src';
import { join } from 'path';
describe('/test/index.test.ts', () => {
it('should invoke normal code', async () => {
const runtime = createRuntime({
functionDir: jo... |
6,150 | 0 | petrpan-code/midwayjs/midway/packages-legacy/serverless-worker-starter | petrpan-code/midwayjs/midway/packages-legacy/serverless-worker-starter/test/node-worker.test.ts | /**
* @jest-environment node
*/
import { sleep } from '@midwayjs/runtime-mock';
import { start, asyncWrapper } from '../src';
import { IncomingMessage, ServerResponse } from './helper/request_response';
class Tester {
handler;
constructor(handler) {
this.handler = handler;
}
async runHttp(context = {}... |
6,151 | 0 | petrpan-code/midwayjs/midway/packages-legacy/serverless-worker-starter | petrpan-code/midwayjs/midway/packages-legacy/serverless-worker-starter/test/service-worker.test.ts | import { sleep } from '@midwayjs/runtime-mock';
import * as assert from 'assert';
import { eventRespondWith, eventWaitUntil, start } from '../src';
import type { JSWorkerExtendableEvent, JSWorkerFetchEvent } from '@midwayjs/jsdom-service-worker';
declare class ExtendableEvent extends Event implements ExtendableEvent ... |
6,197 | 0 | petrpan-code/midwayjs/midway/packages-legacy/task | petrpan-code/midwayjs/midway/packages-legacy/task/test/index.test.ts | import { createApp, close } from '@midwayjs/mock';
import { QueueTask } from './fixtures/base-app/src/task/queue.task';
import { join } from 'path';
import { sleep } from '@midwayjs/core';
import * as TaskModule from '../src';
describe(`midway task`, () => {
let app: TaskModule.Application;
beforeAll(async () => ... |
6,256 | 0 | petrpan-code/midwayjs/midway/packages-serverless/midway-fc-starter | petrpan-code/midwayjs/midway/packages-serverless/midway-fc-starter/test/index.test.ts | import { BootstrapStarter } from '../src';
import { join } from 'path';
import * as events from 'events';
function makeRequest(opts) {
const ee: any = new events.EventEmitter();
ee.path = '/';
ee.method = 'POST';
ee.queries = {};
ee.headers = {};
return Object.assign(ee, opts);
}
function start(options)... |
6,275 | 0 | petrpan-code/midwayjs/midway/packages-serverless/serverless-http-parser | petrpan-code/midwayjs/midway/packages-serverless/serverless-http-parser/test/index.test.ts | import * as assert from 'assert';
import { Application, HTTPRequest, HTTPResponse } from '../src';
import * as mm from 'mm';
import { createReadStream, createWriteStream, readFileSync } from 'fs';
import { join } from 'path';
describe('/test/index.test.ts', () => {
it('should parser tencent apigw event', () => {
... |
6,298 | 0 | petrpan-code/midwayjs/midway/packages/async-hooks-context-manager | petrpan-code/midwayjs/midway/packages/async-hooks-context-manager/test/asyncHooksContextManager.test.ts | /*
* Copyright The OpenTelemetry Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or... |
6,299 | 0 | petrpan-code/midwayjs/midway/packages/async-hooks-context-manager | petrpan-code/midwayjs/midway/packages/async-hooks-context-manager/test/asyncLocalStorageContextManager.test.ts | /*
* Copyright The OpenTelemetry Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or... |
6,300 | 0 | petrpan-code/midwayjs/midway/packages/async-hooks-context-manager | petrpan-code/midwayjs/midway/packages/async-hooks-context-manager/test/util.test.ts | import { isSemverGreaterThanOrEqualTo } from '../src/util';
describe('util.test.ts', function () {
it('should test gte v14.8.0', function () {
expect(isSemverGreaterThanOrEqualTo('v16.0.0', '14.8.0')).toBeTruthy();
expect(isSemverGreaterThanOrEqualTo('v14.17.0', '14.8.0')).toBeTruthy();
expect(isSemverGr... |
6,313 | 0 | petrpan-code/midwayjs/midway/packages/axios | petrpan-code/midwayjs/midway/packages/axios/test/factory.test.ts | import { join } from 'path';
import { HttpServiceFactory } from '../src';
import { createLightApp } from '@midwayjs/mock';
import * as nock from 'nock';
describe('/test/factory.test.ts', () => {
beforeAll(async () => {
nock('https://api.github.com')
.persist()
.get('/users/octocat/orgs')
.repl... |
6,314 | 0 | petrpan-code/midwayjs/midway/packages/axios | petrpan-code/midwayjs/midway/packages/axios/test/index.test.ts | import { join } from 'path';
import { HttpService, axios } from '../src';
import { createLightApp } from '@midwayjs/mock';
import * as nock from 'nock';
describe('/test/index.test.ts', () => {
let httpService: any;
let container;
let app;
beforeAll(async () => {
nock('https://api.github.com')
.persi... |
6,332 | 0 | petrpan-code/midwayjs/midway/packages/bootstrap | petrpan-code/midwayjs/midway/packages/bootstrap/test/bootstrap.test.ts | import { fork } from 'child_process';
import { join } from 'path';
import { sleep } from '@midwayjs/core';
import * as request from 'request';
import { io as socketClient } from 'socket.io-client';
describe('/test/bootstrap.test.ts', () => {
it('should bootstrap multi framework', async () => {
let child = fork('... |
6,349 | 0 | petrpan-code/midwayjs/midway/packages/bootstrap/test | petrpan-code/midwayjs/midway/packages/bootstrap/test/fork/cp.test.ts | import { ClusterManager } from '../../src';
import { join } from 'path';
import * as request from 'request';
import { sleep } from '../../src/util';
const cluster = require('cluster');
function fetch(url) {
return new Promise((resolve, reject) => {
request.get(url, (err, res, body) => {
if (err) {
... |
6,350 | 0 | petrpan-code/midwayjs/midway/packages/bootstrap/test | petrpan-code/midwayjs/midway/packages/bootstrap/test/fork/thread.test.ts | import { join } from 'path';
import * as request from 'request';
import { sleep } from '../../src/util';
import { ThreadManager } from '../../src/manager/thread';
const cluster = require('cluster');
function fetch(url) {
return new Promise((resolve, reject) => {
request.get(url, (err, res, body) => {
if (e... |
6,370 | 0 | petrpan-code/midwayjs/midway/packages/bull-board | petrpan-code/midwayjs/midway/packages/bull-board/test/index.test.ts | import { createApp, close, createHttpRequest } from '@midwayjs/mock';
import { join } from 'path';
describe(`/test/index.test.ts`, () => {
it('test ui in koa', async () => {
const app = await createApp(join(__dirname, 'fixtures', 'base-app-koa'));
// page
let result = await createHttpRequest(app).get('/... |
6,392 | 0 | petrpan-code/midwayjs/midway/packages/bull | petrpan-code/midwayjs/midway/packages/bull/test/index.test.ts | import { createApp, close } from '@midwayjs/mock';
import { join } from 'path';
import { sleep } from '@midwayjs/core';
import * as bull from '../src';
import { readFileSync } from 'fs';
describe(`/test/index.test.ts`, () => {
it('test auto repeat processor', async () => {
const app = await createApp(join(__dirn... |
6,415 | 0 | petrpan-code/midwayjs/midway/packages/cache | petrpan-code/midwayjs/midway/packages/cache/test/cache.test.ts | import * as path from 'path';
import * as assert from 'assert';
import { createLightApp } from '@midwayjs/mock';
describe(`test.cache`, ()=>{
it(`test cache`, async ()=>{
const app = await createLightApp(path.join(__dirname, './fixtures/cache-manager'));
const appCtx = app.getApplicationContext();
const... |
6,433 | 0 | petrpan-code/midwayjs/midway/packages/captcha | petrpan-code/midwayjs/midway/packages/captcha/test/index.test.ts | import { createHttpRequest, close, createApp } from '@midwayjs/mock';
import { join } from 'path';
import * as assert from 'assert';
describe('test/index.test.ts', function () {
let app;
beforeAll(async () => {
const appDir = join(__dirname, 'fixtures/koa');
app = await createApp(appDir);
});
afterAll... |
6,445 | 0 | petrpan-code/midwayjs/midway/packages/casbin-redis-adapter | petrpan-code/midwayjs/midway/packages/casbin-redis-adapter/test/index.test.ts | import { createApp, createHttpRequest, close } from '@midwayjs/mock';
import { IMidwayApplication, sleep } from '@midwayjs/core';
describe('/test/index.test.ts', () => {
it('should test read from redis', async () => {
const app = await createApp('base-app') as IMidwayApplication;
const response = await creat... |
6,465 | 0 | petrpan-code/midwayjs/midway/packages/casbin-typeorm-adapter | petrpan-code/midwayjs/midway/packages/casbin-typeorm-adapter/test/index.test.ts | import { createApp, createHttpRequest } from '@midwayjs/mock';
import { IMidwayApplication } from '@midwayjs/core';
describe('/test/index.test.ts', () => {
it('should test read from typeorm', async () => {
const app = await createApp('base-app') as IMidwayApplication;
const response = await createHttpRequest... |
6,490 | 0 | petrpan-code/midwayjs/midway/packages/casbin | petrpan-code/midwayjs/midway/packages/casbin/test/index.test.ts | import { createApp, createHttpRequest } from '@midwayjs/mock';
import { CasbinEnforcerService } from '../src';
import { IMidwayApplication } from '@midwayjs/core';
describe('/test/index.test.ts', () => {
it('should test casbin api', async () => {
const app = await createApp('base-app') as IMidwayApplication;
... |
6,491 | 0 | petrpan-code/midwayjs/midway/packages/casbin/test | petrpan-code/midwayjs/midway/packages/casbin/test/__snapshots__/index.test.ts.snap | // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`/test/index.test.ts should test casbin api 1`] = `
[
[
"alice",
"data1",
"read",
],
[
"bob",
"data2",
"write",
],
]
`;
|
6,521 | 0 | petrpan-code/midwayjs/midway/packages/code-dye | petrpan-code/midwayjs/midway/packages/code-dye/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... |
6,542 | 0 | petrpan-code/midwayjs/midway/packages/consul | petrpan-code/midwayjs/midway/packages/consul/test/index.test.ts | import {close, createApp, createHttpRequest} from '@midwayjs/mock';
import {IMidwayApplication} from '@midwayjs/core';
import {IConsulBalancer} from '../src';
import { mockConsulAPI } from './mock';
import * as Consul from 'consul';
import { join } from 'path';
import * as nock from 'nock';
describe('/test/feature.tes... |
6,548 | 0 | petrpan-code/midwayjs/midway/packages/consul/test/fixtures/base-app/src | petrpan-code/midwayjs/midway/packages/consul/test/fixtures/base-app/src/controller/test.ts | import {Controller, Get, Inject, Param, Provide} from '@midwayjs/core';
import {IConsulBalancer} from "../../../../../src";
@Provide()
@Controller('/test')
export class TestController {
@Inject('consul:balancerService')
balancerService: IConsulBalancer;
// @ts-ignore
@Get('/balancer/lookup/:serviceName')
as... |
6,647 | 0 | petrpan-code/midwayjs/midway/packages/core | petrpan-code/midwayjs/midway/packages/core/test/baseFramework.test.ts | import * as assert from 'assert';
import * as path from 'path';
import * as mm from 'mm';
import {
getCurrentApplicationContext,
getCurrentMainApp,
getCurrentMainFramework,
MidwayFrameworkService,
MidwayRequestContainer,
MidwayDecoratorService,
MidwayMiddlewareService,
ContextMiddlewareManager,
getCur... |
6,648 | 0 | petrpan-code/midwayjs/midway/packages/core | petrpan-code/midwayjs/midway/packages/core/test/feature.test.ts | import { createLightFramework } from './util';
import { join } from 'path';
import { MidwayMissingImportComponentError, MidwayDefinitionNotFoundError } from '../src';
import { MidwayHealthService } from '../src/service/healthService';
describe('/test/feature.test.ts', () => {
it('should throw error when inject', asy... |
6,649 | 0 | petrpan-code/midwayjs/midway/packages/core | petrpan-code/midwayjs/midway/packages/core/test/init.test.ts | import { Destroy, Init, Provide, Scope, ScopeEnum, MidwayContainer, MidwayLoggerService, MidwayConfigService, MidwayEnvironmentService, MidwayInformationService } from '../src';
class Parent {}
@Provide()
@Scope(ScopeEnum.Singleton)
class Test extends Parent {
@Init()
async init() {
console.log('run');
}
... |
6,650 | 0 | petrpan-code/midwayjs/midway/packages/core | petrpan-code/midwayjs/midway/packages/core/test/issue.test.ts | import { HomeController } from '../../../packages-resource/midway-test-component';
import { createLightFramework } from './util';
import { join } from 'path';
describe('/test/issue.test.ts', () => {
it('should fix issue 1277', async () => {
const framework = await createLightFramework(join(
__dirname,
... |
6,651 | 0 | petrpan-code/midwayjs/midway/packages/core | petrpan-code/midwayjs/midway/packages/core/test/logger.test.ts | import { MidwayContextLogger } from '@midwayjs/logger';
import { join } from 'path';
import * as mm from 'mm';
import { tmpdir } from 'os';
import { existsSync } from 'fs';
import { createLightFramework } from './util';
import { clearAllModule } from '../src';
describe('/test/logger.test.ts', () => {
beforeEach(() =... |
6,652 | 0 | petrpan-code/midwayjs/midway/packages/core | petrpan-code/midwayjs/midway/packages/core/test/paramMapping.test.ts | import { extractKoaLikeValue, extractExpressLikeValue, ALL, RouteParamTypes } from '../src';
describe('/test/web/paramMapping.test.ts', () => {
it('extract koa value should be ok', async () => {
let fn = extractKoaLikeValue(RouteParamTypes.NEXT, {});
expect(await fn({}, 'next')).toEqual('next');
fn = ex... |
6,653 | 0 | petrpan-code/midwayjs/midway/packages/core | petrpan-code/midwayjs/midway/packages/core/test/proxy.test.ts | import * as assert from 'assert';
import { extend } from '../src';
describe('/test/proxy.test.ts', () => {
it('should proxy app when set property', () => {
let app = {};
const pluginContext = {};
app = new Proxy<any>(app, {
defineProperty(target, prop, attributes) {
pluginContext[prop] = a... |
6,654 | 0 | petrpan-code/midwayjs/midway/packages/core | petrpan-code/midwayjs/midway/packages/core/test/setup.test.ts | import { join } from 'path';
import {
BaseFramework,
destroyGlobalApplicationContext,
IMidwayApplication,
IMidwayBootstrapOptions,
initializeGlobalApplicationContext,
MidwayConfigService,
MidwayFrameworkType,
Configuration,
Framework,
Inject,
} from '../src';
describe('/test/setup.test.ts', () => {... |
6,656 | 0 | petrpan-code/midwayjs/midway/packages/core/test | petrpan-code/midwayjs/midway/packages/core/test/common/applicationManager.test.ts | import { MidwayApplicationManager, BaseFramework, MidwayFrameworkType, MidwayMockService } from '../../src';
describe('test/common/applicationManager.test.ts', () => {
it('should test application manager', async () => {
const manager = new MidwayApplicationManager();
const mockService = new MidwayMockService... |
6,657 | 0 | petrpan-code/midwayjs/midway/packages/core/test | petrpan-code/midwayjs/midway/packages/core/test/common/contextManager.test.ts | import * as assert from 'assert';
import { NoopContextManager, ASYNC_ROOT_CONTEXT } from '../../src/common/asyncContextManager';
/** Get a key to uniquely identify a context value */
function createContextKey(description: string) {
// The specification states that for the same input, multiple calls should
// retur... |
6,658 | 0 | petrpan-code/midwayjs/midway/packages/core/test | petrpan-code/midwayjs/midway/packages/core/test/common/dataListener.test.ts | import { DataListener, MidwayContainer, Provide, Scope, ScopeEnum, sleep } from '../../src';
describe('test/common/dataListener.test.ts', () => {
@Provide()
@Scope(ScopeEnum.Singleton)
class TestDataListener extends DataListener<string> {
initData() {
return 'hello';
}
onData(setData) {
... |
6,659 | 0 | petrpan-code/midwayjs/midway/packages/core/test | petrpan-code/midwayjs/midway/packages/core/test/common/dataSourceManager.test.ts | import { DataSourceManager } from '../../src';
import { globModels, formatGlobString } from '../../src/common/dataSourceManager';
import { join } from 'path';
import * as assert from 'assert';
describe('test/common/dataSourceManager.test.ts', () => {
class CustomDataSourceFactory extends DataSourceManager<any> {
... |
6,660 | 0 | petrpan-code/midwayjs/midway/packages/core/test | petrpan-code/midwayjs/midway/packages/core/test/common/detector.test.ts | import { CommonJSFileDetector, MidwayDuplicateClassNameError, CustomModuleDetector, MidwayContainer } from '../../src';
import { join } from 'path';
describe('test/common/detector.test.ts', function () {
it('should test file detector', async () => {
const detector = new CommonJSFileDetector({
loadDir: joi... |
6,661 | 0 | petrpan-code/midwayjs/midway/packages/core/test | petrpan-code/midwayjs/midway/packages/core/test/common/filterManager.test.ts | import { FilterManager, MidwayContainer, MidwayError, Catch, Match } from '../../src';
describe('/test/common/filterManager.test.ts', function () {
it('should test default error filter', async () => {
const container = new MidwayContainer();
const filterManager = new FilterManager();
@Catch()
class ... |
6,662 | 0 | petrpan-code/midwayjs/midway/packages/core/test | petrpan-code/midwayjs/midway/packages/core/test/common/middlewareManager.test.ts | import { ContextMiddlewareManager } from '../../src';
const mw1 = async (ctx, next) => {};
mw1._name = 'mw1';
const mw2 = async (ctx, next) => {};
mw2._name = 'mw2';
const mw3 = class MW3 {resolve() {}} as any;
const mw4 = class MW4 {resolve() {}} as any;
function mw5(){}
function mw6(){}
describe('test/common/mid... |
6,663 | 0 | petrpan-code/midwayjs/midway/packages/core/test | petrpan-code/midwayjs/midway/packages/core/test/common/notFoundError.test.ts | import { MidwayDefinitionNotFoundError } from '../../src';
describe('/test/common/notFoundError.test.ts', () => {
it('should test not found error', function () {
const creatNormalError = function(msg) {
throw new Error(msg);
};
const creatNotFoundError = function(msg) {
throw new MidwayDefini... |
6,665 | 0 | petrpan-code/midwayjs/midway/packages/core/test | petrpan-code/midwayjs/midway/packages/core/test/common/serviceFactory.test.ts | import { ServiceFactory } from '../../src';
describe('test/common/serviceFactory.test.ts', () => {
class TestServiceFactory extends ServiceFactory<any> {
protected createClient(config: any): any {
const client = {
aaa: 123,
isClose: false,
async close() {
client.isClose ... |
6,666 | 0 | petrpan-code/midwayjs/midway/packages/core/test | petrpan-code/midwayjs/midway/packages/core/test/common/webGenerator.test.ts | import {
WebControllerGenerator,
RouterInfo,
IMidwayApplication,
MidwayWebRouterService,
MidwayContainer,
MidwayMiddlewareService,
Get,
WEB_RESPONSE_HTTP_CODE, WEB_RESPONSE_HEADER, WEB_RESPONSE_CONTENT_TYPE, WEB_RESPONSE_REDIRECT
} from '../../src';
describe('test/common/web_generator.test.ts', functio... |
6,667 | 0 | petrpan-code/midwayjs/midway/packages/core/test | petrpan-code/midwayjs/midway/packages/core/test/common/webRouterCollector.test.ts | import { WebRouterCollector, clearAllModule } from '../../src';
import { join } from 'path';
describe('/test/common/webRouterCollector.test.ts', function () {
it('should test generate router', async () => {
clearAllModule()
const collector = new WebRouterCollector(join(__dirname, '../fixtures/base-app-contr... |
6,668 | 0 | petrpan-code/midwayjs/midway/packages/core/test/common | petrpan-code/midwayjs/midway/packages/core/test/common/__snapshots__/dataSourceManager.test.ts.snap | // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`test/common/dataSourceManager.test.ts should test base data source 1`] = `
{
"dialect": "mysql",
"entities": [
[Function],
[Function],
],
"entitiesLength": 2,
"host": "localhost",
"pool": {
"idle": 10000,
"max": 5,
"min": 0,
},
"po... |
6,669 | 0 | petrpan-code/midwayjs/midway/packages/core/test/common | petrpan-code/midwayjs/midway/packages/core/test/common/__snapshots__/middlewareManager.test.ts.snap | // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`test/common/middlewareManager.test.ts should remove middleware 1`] = `
ContextMiddlewareManager [
"MW4",
"MW3",
"mw2",
]
`;
exports[`test/common/middlewareManager.test.ts should remove middleware 2`] = `
ContextMiddlewareManager [
"MW4",
"mw2",
]
`;
expor... |
6,685 | 0 | petrpan-code/midwayjs/midway/packages/core/test | petrpan-code/midwayjs/midway/packages/core/test/context/applicationContext.test.ts | import { ObjectDefinitionRegistry } from '../../src/context/definitionRegistry';
import { ObjectDefinition } from '../../src/definitions/objectDefinition';
import { MidwayContainer } from '../../src';
describe('/test/context/applicationContext.test.ts', () => {
describe('ObjectDefinitionRegistry', () => {
it('sh... |
6,686 | 0 | petrpan-code/midwayjs/midway/packages/core/test | petrpan-code/midwayjs/midway/packages/core/test/context/container.test.ts | import {
MidwayConfigService,
MidwayContainer as Container,
MidwayEnvironmentService,
MidwayFrameworkService,
MidwayInformationService,
MidwayLoggerService,
MidwayDecoratorService,
MidwayAspectService,
APPLICATION_KEY,
CONFIG_KEY,
PLUGIN_KEY,
INJECT_TAG,
getClassExtendedMetadata
} from '../../... |
6,687 | 0 | petrpan-code/midwayjs/midway/packages/core/test | petrpan-code/midwayjs/midway/packages/core/test/context/managedResolverFactory.test.ts | import { ManagedResolverFactory } from '../../src/context/managedResolverFactory';
import { ObjectDefinition } from '../../src/definitions/objectDefinition';
import { MidwayContainer } from '../../src';
describe('/test/context/managedResolverFactory.test.ts', () => {
it('create get deps should be ok', async () => {
... |
6,688 | 0 | petrpan-code/midwayjs/midway/packages/core/test | petrpan-code/midwayjs/midway/packages/core/test/context/midwayContainer.test.ts | import * as path from 'path';
import {
MidwayContainer,
MidwayRequestContainer,
CommonJSFileDetector,
MidwayLoggerService,
MidwayConfigService,
MidwayEnvironmentService,
MidwayFrameworkService,
MidwayInformationService,
MidwayDecoratorService,
MidwayAspectService,
APPLICATION_KEY,
clearAllModule... |
6,689 | 0 | petrpan-code/midwayjs/midway/packages/core/test | petrpan-code/midwayjs/midway/packages/core/test/context/requestContainer.test.ts | import {
MidwayContainer as Container,
MidwayRequestContainer as RequestContainer,
MidwaySingletonInjectRequestError,
REQUEST_OBJ_CTX_KEY,
Inject,
Provide,
Scope,
ScopeEnum, SINGLETON_CONTAINER_CTX
} from '../../src';
import {
AppService,
AutoScaleService,
CCController,
CircularOne,
CircularTh... |
6,690 | 0 | petrpan-code/midwayjs/midway/packages/core/test | petrpan-code/midwayjs/midway/packages/core/test/decorator/decoratorManager.test.ts | import { Get, getMethodParamTypes } from '../../src';
describe('/test/decoratorManager.test.ts', () => {
it('should test getMethodParamTypes', 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: ... |
6,691 | 0 | petrpan-code/midwayjs/midway/packages/core/test | petrpan-code/midwayjs/midway/packages/core/test/decorator/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);
... |
6,692 | 0 | petrpan-code/midwayjs/midway/packages/core/test/decorator | petrpan-code/midwayjs/midway/packages/core/test/decorator/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... |
6,693 | 0 | petrpan-code/midwayjs/midway/packages/core/test/decorator | petrpan-code/midwayjs/midway/packages/core/test/decorator/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);
... |
6,694 | 0 | petrpan-code/midwayjs/midway/packages/core/test/decorator | petrpan-code/midwayjs/midway/packages/core/test/decorator/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('/... |
6,695 | 0 | petrpan-code/midwayjs/midway/packages/core/test/decorator | petrpan-code/midwayjs/midway/packages/core/test/decorator/annotation/filter.test.ts | import { Catch, getClassMetadata, Match, CATCH_KEY, MATCH_KEY } from '../../../src';
class CustomError extends Error {}
@Catch(CustomError)
class Test {}
@Catch()
class TestGlobal {}
@Catch([CustomError], {
matchPrototype: true,
})
class Test1 {}
@Match()
class Test2 {}
describe('/test/annotation/filter.test.ts... |
6,696 | 0 | petrpan-code/midwayjs/midway/packages/core/test/decorator | petrpan-code/midwayjs/midway/packages/core/test/decorator/annotation/framework.test.ts | import { Framework, FRAMEWORK_KEY, getObjectDefinition, listModule } from '../../../src';
@Framework()
class CustomFramework {}
describe('/test/annotation/framework.test.ts', () => {
it('test framework decorator', () => {
const meta = getObjectDefinition(CustomFramework);
expect(meta).toMatchSnapshot();
... |
6,697 | 0 | petrpan-code/midwayjs/midway/packages/core/test/decorator | petrpan-code/midwayjs/midway/packages/core/test/decorator/annotation/inject.test.ts | import { Provide, Inject, getPropertyInject } from '../../../src';
@Provide()
class InjectChild {
}
class InjectChild2 {
}
class Test {
@Inject()
aa: any;
@Inject()
ee: InjectChild;
@Inject()
ff: InjectChild2;
}
describe('/test/annotation/inject.test.ts', () => {
it('inject decorator should be ok',... |
6,698 | 0 | petrpan-code/midwayjs/midway/packages/core/test/decorator | petrpan-code/midwayjs/midway/packages/core/test/decorator/annotation/middleware.test.ts | import { Middleware, getObjectDefinition } from '../../../src';
@Middleware()
class CustomMiddleware {}
describe('/test/annotation/middleware.test.ts', () => {
it('test middleware decorator', () => {
const meta = getObjectDefinition(CustomMiddleware);
expect(meta).toMatchSnapshot();
});
});
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.