level_0
int64
0
10k
index
int64
0
0
repo_id
stringlengths
22
152
file_path
stringlengths
41
203
content
stringlengths
11
11.5M
2,255
0
petrpan-code/appsmithorg/appsmith/app/client/src/widgets/wds/WDSInputWidget/widget/propertyPaneConfig
petrpan-code/appsmithorg/appsmith/app/client/src/widgets/wds/WDSInputWidget/widget/propertyPaneConfig/validations/index.test.ts
import _ from "lodash"; import { minValueValidation, maxValueValidation, defaultValueValidation, } from "."; import type { InputWidgetProps } from "../../types"; describe("defaultValueValidation", () => { let result: ReturnType<typeof defaultValueValidation>; it("should validate defaulttext of text type", ...
2,265
0
petrpan-code/appsmithorg/appsmith/app/client/src/widgets/wds/WDSPhoneInputWidget
petrpan-code/appsmithorg/appsmith/app/client/src/widgets/wds/WDSPhoneInputWidget/widget/derived.test.ts
import derivedProperty from "./derived"; describe("Derived property - ", () => { describe("isValid property", () => { it("should test isRequired", () => { let isValid = derivedProperty.isValid({ text: undefined, isRequired: false, }); expect(isValid).toBeTruthy(); isVali...
2,266
0
petrpan-code/appsmithorg/appsmith/app/client/src/widgets/wds/WDSPhoneInputWidget
petrpan-code/appsmithorg/appsmith/app/client/src/widgets/wds/WDSPhoneInputWidget/widget/helpers.test.ts
import { countryToFlag } from "./helpers"; describe("Utilities - ", () => { it("should test countryToFlag", () => { [ ["+91", "🇮🇳"], ["+1", "🇺🇸"], ["", ""], ].forEach((d) => { expect(countryToFlag(d[0])).toBe(d[1]); }); }); });
2,280
0
petrpan-code/appsmithorg/appsmith/app/client/src/widgets/wds/WDSPhoneInputWidget/widget/config/propertyPaneConfig
petrpan-code/appsmithorg/appsmith/app/client/src/widgets/wds/WDSPhoneInputWidget/widget/config/propertyPaneConfig/validations/defaultValueValidation.test.ts
import type { PhoneInputWidgetProps } from "../../../types"; import { defaultValueValidation } from "./defaultValueValidation"; import _ from "lodash"; describe("defaultValueValidation", () => { let result: ReturnType<typeof defaultValueValidation>; it("should validate defaulttext", () => { result = defaultVa...
2,335
0
petrpan-code/appsmithorg/appsmith/app/client/src/widgets/wds/WDSTableWidget
petrpan-code/appsmithorg/appsmith/app/client/src/widgets/wds/WDSTableWidget/component/Constants.test.ts
import { ConditionFunctions } from "./Constants"; import moment from "moment"; describe("ConditionFunctions Constants", () => { it("works as expected for isExactly", () => { const conditionFunction = ConditionFunctions["isExactly"]; expect(conditionFunction("test", "test")).toStrictEqual(true); }); it("w...
2,358
0
petrpan-code/appsmithorg/appsmith/app/client/src/widgets/wds/WDSTableWidget/component
petrpan-code/appsmithorg/appsmith/app/client/src/widgets/wds/WDSTableWidget/component/cellComponents/PlainTextCell.test.tsx
import { getCellText } from "./PlainTextCell"; import { ColumnTypes } from "widgets/wds/WDSTableWidget/constants"; describe("DefaultRendere - ", () => { describe("getCellText", () => { it("should test with different values", () => { [ { value: "#1", cellProperties: { displayText...
2,370
0
petrpan-code/appsmithorg/appsmith/app/client/src/widgets/wds/WDSTableWidget/component/header
petrpan-code/appsmithorg/appsmith/app/client/src/widgets/wds/WDSTableWidget/component/header/actions/Utilities.test.ts
import { transformTableDataIntoCsv } from "./Utilities"; import type { TableColumnProps } from "../../Constants"; import { ColumnTypes } from "widgets/wds/WDSTableWidget/constants"; describe("TransformTableDataIntoArrayOfArray", () => { const columns: TableColumnProps[] = [ { Header: "Id", id: "id", ...
2,385
0
petrpan-code/appsmithorg/appsmith/app/client/src/widgets/wds/WDSTableWidget
petrpan-code/appsmithorg/appsmith/app/client/src/widgets/wds/WDSTableWidget/widget/propertyUtils.test.ts
import { totalRecordsCountValidation, uniqueColumnNameValidation, updateColumnStyles, updateColumnOrderHook, getBasePropertyPath, hideByColumnType, uniqueColumnAliasValidation, updateCustomColumnAliasOnLabelChange, selectColumnOptionsValidation, allowedFirstDayOfWeekRange, } from "./propertyUtils"; ...
2,387
0
petrpan-code/appsmithorg/appsmith/app/client/src/widgets/wds/WDSTableWidget
petrpan-code/appsmithorg/appsmith/app/client/src/widgets/wds/WDSTableWidget/widget/utilities.test.ts
import type { ColumnProperties, TableStyles } from "../component/Constants"; import { StickyType } from "../component/Constants"; import { ColumnTypes } from "../constants"; import { convertNumToCompactString, escapeString, generateNewColumnOrderFromStickyValue, getAllTableColumnKeys, getArrayPropertyValue, ...
2,438
0
petrpan-code/appsmithorg/appsmith/app/client/src/workers
petrpan-code/appsmithorg/appsmith/app/client/src/workers/Evaluation/helpers.test.ts
import { fn_keys, stringifyFnsInObject } from "./helpers"; describe("stringifyFnsInObject", () => { it("includes full path of key having a function in the parent object", () => { const obj = { key1: "value", key2: { key3: { fnKey: () => {}, }, }, }; const resul...
2,450
0
petrpan-code/appsmithorg/appsmith/app/client/src/workers/Evaluation
petrpan-code/appsmithorg/appsmith/app/client/src/workers/Evaluation/JSObject/test.ts
import type { ConfigTree, UnEvalTree } from "entities/DataTree/dataTreeTypes"; import { getUpdatedLocalUnEvalTreeAfterJSUpdates } from "."; describe("updateJSCollectionInUnEvalTree", function () { it("updates async value of jsAction", () => { const jsUpdates = { JSObject1: { parsedBody: { ...
2,452
0
petrpan-code/appsmithorg/appsmith/app/client/src/workers/Evaluation/JSObject
petrpan-code/appsmithorg/appsmith/app/client/src/workers/Evaluation/JSObject/__test__/JSVariableFactory.test.ts
import ExecutionMetaData from "workers/Evaluation/fns/utils/ExecutionMetaData"; import type { JSActionEntity } from "@appsmith/entities/DataTree/types"; import TriggerEmitter, { jsVariableUpdatesHandlerWrapper, } from "workers/Evaluation/fns/utils/TriggerEmitter"; import JSObjectCollection from "../Collection"; cons...
2,453
0
petrpan-code/appsmithorg/appsmith/app/client/src/workers/Evaluation/JSObject
petrpan-code/appsmithorg/appsmith/app/client/src/workers/Evaluation/JSObject/__test__/mutation.test.ts
import type { DataTree } from "entities/DataTree/dataTreeTypes"; import { ENTITY_TYPE_VALUE } from "entities/DataTree/dataTreeFactory"; import { createEvaluationContext } from "workers/Evaluation/evaluate"; import JSObjectCollection from "../Collection"; import ExecutionMetaData from "workers/Evaluation/fns/utils/Execu...
2,454
0
petrpan-code/appsmithorg/appsmith/app/client/src/workers/Evaluation
petrpan-code/appsmithorg/appsmith/app/client/src/workers/Evaluation/__tests__/Actions.test.ts
import type { ActionEntity } from "@appsmith/entities/DataTree/types"; import type { DataTree } from "entities/DataTree/dataTreeTypes"; import { ENTITY_TYPE_VALUE } from "entities/DataTree/dataTreeFactory"; import { PluginType } from "entities/Action"; import type { EvalContext } from "workers/Evaluation/evaluate"; imp...
2,456
0
petrpan-code/appsmithorg/appsmith/app/client/src/workers/Evaluation
petrpan-code/appsmithorg/appsmith/app/client/src/workers/Evaluation/__tests__/errorModifier.test.ts
import type { DataTree } from "entities/DataTree/dataTreeTypes"; import { ActionInDataFieldErrorModifier, TypeErrorModifier, errorModifier, } from "../errorModifier"; import DependencyMap from "entities/DependencyMap"; import { APP_MODE } from "entities/App"; describe("Test error modifier", () => { const dataT...
2,457
0
petrpan-code/appsmithorg/appsmith/app/client/src/workers/Evaluation
petrpan-code/appsmithorg/appsmith/app/client/src/workers/Evaluation/__tests__/evaluate.test.ts
import evaluate, { evaluateAsync } from "workers/Evaluation/evaluate"; import type { WidgetEntity } from "@appsmith/entities/DataTree/types"; import type { DataTree } from "entities/DataTree/dataTreeTypes"; import { ENTITY_TYPE_VALUE } from "entities/DataTree/dataTreeFactory"; import { RenderModes } from "constants/Wid...
2,458
0
petrpan-code/appsmithorg/appsmith/app/client/src/workers/Evaluation
petrpan-code/appsmithorg/appsmith/app/client/src/workers/Evaluation/__tests__/evaluation.test.ts
import type { WidgetEntity, WidgetEntityConfig, ActionEntityConfig, ActionEntity, } from "@appsmith/entities/DataTree/types"; import type { UnEvalTree, ConfigTree } from "entities/DataTree/dataTreeTypes"; import { ENTITY_TYPE_VALUE, EvaluationSubstitutionType, } from "entities/DataTree/dataTreeFactory"; imp...
2,459
0
petrpan-code/appsmithorg/appsmith/app/client/src/workers/Evaluation
petrpan-code/appsmithorg/appsmith/app/client/src/workers/Evaluation/__tests__/evaluationSubstitution.test.ts
import { substituteDynamicBindingWithValues } from "workers/Evaluation/evaluationSubstitution"; import { EvaluationSubstitutionType } from "entities/DataTree/dataTreeFactory"; describe("substituteDynamicBindingWithValues", () => { describe("template substitution", () => { it("substitutes strings values", () => {...
2,460
0
petrpan-code/appsmithorg/appsmith/app/client/src/workers/Evaluation
petrpan-code/appsmithorg/appsmith/app/client/src/workers/Evaluation/__tests__/formEval.test.ts
import { extractFetchDynamicValueFormConfigs, extractQueueOfValuesToBeFetched, } from "sagas/helper"; describe("Fetch dynamic values", () => { const testInput = { identifier1: { visible: true, enabled: false, fetchDynamicValues: { allowedToFetch: true, isLoading: true, ...
2,461
0
petrpan-code/appsmithorg/appsmith/app/client/src/workers/Evaluation
petrpan-code/appsmithorg/appsmith/app/client/src/workers/Evaluation/__tests__/generateOpimisedUpdates.test.ts
/* eslint-disable @typescript-eslint/no-empty-function */ import { applyChange } from "deep-diff"; import produce from "immer"; import { range } from "lodash"; import moment from "moment"; import { parseUpdatesAndDeleteUndefinedUpdates } from "sagas/EvaluationSaga.utils"; import { EvalErrorTypes } from "utils/DynamicBi...
2,462
0
petrpan-code/appsmithorg/appsmith/app/client/src/workers/Evaluation
petrpan-code/appsmithorg/appsmith/app/client/src/workers/Evaluation/__tests__/helpers.test.ts
import { findDuplicateIndex } from "../helpers"; describe("Worker Helper functions test", () => { it("Correctly finds the duplicate index in an array of strings", () => { const input = ["a", "b", "c", "d", "e", "a", "b"]; const expected = 5; const result = findDuplicateIndex(input); expect(result).to...
2,464
0
petrpan-code/appsmithorg/appsmith/app/client/src/workers/Evaluation
petrpan-code/appsmithorg/appsmith/app/client/src/workers/Evaluation/__tests__/setters.test.ts
import { generateDataTreeWidget } from "entities/DataTree/dataTreeWidget"; import setters from "../setters"; import TableWidget from "widgets/TableWidgetV2/widget"; import { RenderModes } from "constants/WidgetConstants"; import type { ConfigTree, DataTree } from "entities/DataTree/dataTreeTypes"; import { createEvalua...
2,465
0
petrpan-code/appsmithorg/appsmith/app/client/src/workers/Evaluation
petrpan-code/appsmithorg/appsmith/app/client/src/workers/Evaluation/__tests__/timeout.test.ts
import { PluginType } from "entities/Action"; import type { ActionEntity } from "@appsmith/entities/DataTree/types"; import type { DataTree } from "entities/DataTree/dataTreeTypes"; import { ENTITY_TYPE_VALUE } from "entities/DataTree/dataTreeFactory"; import { createEvaluationContext } from "../evaluate"; import { add...
2,466
0
petrpan-code/appsmithorg/appsmith/app/client/src/workers/Evaluation
petrpan-code/appsmithorg/appsmith/app/client/src/workers/Evaluation/__tests__/validations.test.ts
import { validate, WIDGET_TYPE_VALIDATION_ERROR, } from "workers/Evaluation/validations"; import type { WidgetProps } from "widgets/BaseWidget"; import { RenderModes } from "constants/WidgetConstants"; import { ValidationTypes } from "constants/WidgetValidation"; import moment from "moment"; import { AutocompleteDa...
2,481
0
petrpan-code/appsmithorg/appsmith/app/client/src/workers/Evaluation/fns
petrpan-code/appsmithorg/appsmith/app/client/src/workers/Evaluation/fns/__tests__/LocalStorage.test.ts
import { addPlatformFunctionsToEvalContext } from "@appsmith/workers/Evaluation/Actions"; import { PluginType } from "entities/Action"; import type { ActionEntity } from "@appsmith/entities/DataTree/types"; import type { DataTree } from "entities/DataTree/dataTreeTypes"; import { createEvaluationContext } from "workers...
2,482
0
petrpan-code/appsmithorg/appsmith/app/client/src/workers/Evaluation/fns
petrpan-code/appsmithorg/appsmith/app/client/src/workers/Evaluation/fns/__tests__/interval.test.ts
jest.useFakeTimers(); import { EventType } from "constants/AppsmithActionConstants/ActionConstants"; import { PluginType } from "entities/Action"; import type { ActionEntity } from "@appsmith/entities/DataTree/types"; import type { DataTree } from "entities/DataTree/dataTreeTypes"; import { ENTITY_TYPE_VALUE } from "e...
2,483
0
petrpan-code/appsmithorg/appsmith/app/client/src/workers/Evaluation/fns
petrpan-code/appsmithorg/appsmith/app/client/src/workers/Evaluation/fns/__tests__/postWindowMessage.test.ts
import { addPlatformFunctionsToEvalContext } from "@appsmith/workers/Evaluation/Actions"; import TriggerEmitter, { BatchKey } from "../utils/TriggerEmitter"; import { evalContext } from "../mock"; const pingMock = jest.fn(); jest.mock("../utils/Messenger.ts", () => ({ WorkerMessenger: { ping: (payload: any) => ...
2,484
0
petrpan-code/appsmithorg/appsmith/app/client/src/workers/Evaluation/fns
petrpan-code/appsmithorg/appsmith/app/client/src/workers/Evaluation/fns/__tests__/run.test.ts
import { MAIN_THREAD_ACTION } from "@appsmith/workers/Evaluation/evalWorkerActions"; import { addPlatformFunctionsToEvalContext } from "@appsmith/workers/Evaluation/Actions"; import { EventType } from "constants/AppsmithActionConstants/ActionConstants"; import ExecutionMetaData from "../utils/ExecutionMetaData"; import...
2,497
0
petrpan-code/appsmithorg/appsmith/app/client/src/workers/Evaluation/fns/utils
petrpan-code/appsmithorg/appsmith/app/client/src/workers/Evaluation/fns/utils/__tests__/Messenger.test.ts
import { MessageType } from "utils/MessageUtil"; import { WorkerMessenger } from "../Messenger"; describe("Tests all worker messenger method", () => { const mockPostMessage = jest.fn(); self.postMessage = mockPostMessage; afterEach(() => { mockPostMessage.mockClear(); }); it("messenger.request", () => { ...
2,498
0
petrpan-code/appsmithorg/appsmith/app/client/src/workers/Evaluation/fns/utils
petrpan-code/appsmithorg/appsmith/app/client/src/workers/Evaluation/fns/utils/__tests__/Promisify.test.ts
// eslint-disable-next-line @typescript-eslint/no-unused-vars const requestMock = jest.fn(async (...args: any) => Promise.resolve("success")); jest.mock("../Messenger.ts", () => ({ ...jest.requireActual("../Messenger.ts"), WorkerMessenger: { request: async (...args: any) => requestMock(...args), }, })); jes...
2,499
0
petrpan-code/appsmithorg/appsmith/app/client/src/workers/Evaluation/fns/utils
petrpan-code/appsmithorg/appsmith/app/client/src/workers/Evaluation/fns/utils/__tests__/TriggerEmitter.test.ts
const pingMock = jest.fn(); jest.mock("../Messenger.ts", () => ({ ...jest.requireActual("../Messenger.ts"), get WorkerMessenger() { return { ping: (...args: any) => { pingMock(JSON.stringify(args[0])); }, }; }, })); import { MAIN_THREAD_ACTION } from "@appsmith/workers/Evaluation/eval...
2,512
0
petrpan-code/appsmithorg/appsmith/app/client/src/workers/Evaluation/handlers
petrpan-code/appsmithorg/appsmith/app/client/src/workers/Evaluation/handlers/__tests__/evalTree.test.ts
import { WorkerMessenger } from "workers/Evaluation/fns/utils/Messenger"; import { evalTreeTransmissionErrorHandler } from "../evalTree"; import { isFunction } from "lodash"; const mockEvalErrorHandler = jest.fn(); const mockSendMessage = jest.fn(); jest.mock("workers/Evaluation/handlers/evalTree", () => { const ac...
2,513
0
petrpan-code/appsmithorg/appsmith/app/client/src/workers/Evaluation/handlers
petrpan-code/appsmithorg/appsmith/app/client/src/workers/Evaluation/handlers/__tests__/jsLibrary.test.ts
import { flattenModule, installLibrary, uninstallLibrary } from "../jsLibrary"; import { EVAL_WORKER_ASYNC_ACTION, EVAL_WORKER_SYNC_ACTION, } from "@appsmith/workers/Evaluation/evalWorkerActions"; import * as mod from "../../../common/JSLibrary/ternDefinitionGenerator"; jest.mock("../../../common/JSLibrary/ternDef...
2,516
0
petrpan-code/appsmithorg/appsmith/app/client/src/workers/common
petrpan-code/appsmithorg/appsmith/app/client/src/workers/common/DataTreeEvaluator/test.ts
import DataTreeEvaluator from "."; import { unEvalTree } from "./mockData/mockUnEvalTree"; import { configTree } from "./mockData/mockConfigTree"; import type { DataTree, ConfigTree } from "entities/DataTree/dataTreeTypes"; import type { DataTreeDiff } from "@appsmith/workers/Evaluation/evaluationUtils"; import { arr...
2,524
0
petrpan-code/appsmithorg/appsmith/app/client/src/workers/common
petrpan-code/appsmithorg/appsmith/app/client/src/workers/common/DependencyMap/test.ts
import ButtonWidget from "widgets/ButtonWidget"; import SelectWidget from "widgets/SelectWidget"; import type { WidgetEntity, DataTreeEntityConfig, } from "@appsmith/entities/DataTree/types"; import { getEntityPathDependencies } from "./utils/getEntityDependencies"; import type BaseWidget from "widgets/BaseWidget";...
2,531
0
petrpan-code/appsmithorg/appsmith/app/client/src/workers/common/JSLibrary
petrpan-code/appsmithorg/appsmith/app/client/src/workers/common/JSLibrary/__tests__/ternDefinitionGenerator.test.ts
import { makeTernDefs } from "../ternDefinitionGenerator"; describe("Tests tern definition generator", () => { const obj = { var1: "myVar1", var2: 2, var3: true, var4: null, var5: undefined, var6: { a: 1, b: 2 }, var7: () => { return "there!"; }, var8: function () { re...
4,624
0
petrpan-code/trpc/trpc/examples/.experimental/next-app-dir
petrpan-code/trpc/trpc/examples/.experimental/next-app-dir/test/client.test.ts
import { expect, test } from '@playwright/test'; test.setTimeout(35e3); // // TODO: Activate client tests once we have the React Query setup working test('client: refreshing the page should reuse the cached value', async ({ page, }) => { await page.goto('/client'); // await page.waitForSelector('text=hello ...
4,625
0
petrpan-code/trpc/trpc/examples/.experimental/next-app-dir
petrpan-code/trpc/trpc/examples/.experimental/next-app-dir/test/server-cache.test.ts
import { expect, test } from '@playwright/test'; test.setTimeout(35e3); // Initial page.reload is due to dev server having a more aggressive // cache invalidation strategy. test('server-cacheLink: refreshing the page should reuse the cached value', async ({ page, }) => { await page.goto('/rsc'); await page.rel...
4,626
0
petrpan-code/trpc/trpc/examples/.experimental/next-app-dir
petrpan-code/trpc/trpc/examples/.experimental/next-app-dir/test/server-http.test.ts
import { expect, test } from '@playwright/test'; test.setTimeout(35e3); // Initial page.reload is due to dev server having a more aggressive // cache invalidation strategy. test('server-httpLink: refreshing the page should reuse the cached value', async ({ page, }) => { await page.goto('/rsc'); await page.relo...
4,657
0
petrpan-code/trpc/trpc/examples/.interop/next-prisma-starter
petrpan-code/trpc/trpc/examples/.interop/next-prisma-starter/playwright/smoke.test.ts
import { test, expect } from '@playwright/test'; test.setTimeout(35e3); test('go to /', async ({ page }) => { await page.goto('/'); await page.waitForSelector(`text=Starter`); }); test('test 404', async ({ page }) => { const res = await page.goto('/post/not-found'); expect(res?.status()).toBe(404); }); tes...
4,674
0
petrpan-code/trpc/trpc/examples/.interop/next-prisma-starter/src/server
petrpan-code/trpc/trpc/examples/.interop/next-prisma-starter/src/server/routers/post.test.ts
/** * Integration test example for the `post` router */ import { createContextInner } from '../context'; import { appRouter } from './_app'; import { inferMutationInput } from '~/utils/trpc'; test('add and get post', async () => { const ctx = await createContextInner({}); const caller = appRouter.createCaller(ct...
4,714
0
petrpan-code/trpc/trpc/examples/.test/ssg
petrpan-code/trpc/trpc/examples/.test/ssg/test/smoke.test.ts
import { expect, test } from '@playwright/test'; test('query should be prefetched', async ({ page }) => { await page.goto('/'); /** * Since we're prefetching the query, and have JavaScript disabled, * the data should be available immediately */ expect(await page.textContent('h1')).toBe('hello client');...
4,782
0
petrpan-code/trpc/trpc/examples/minimal-react
petrpan-code/trpc/trpc/examples/minimal-react/test/smoke.test.ts
import { test } from '@playwright/test'; test.setTimeout(35e3); test('go to /', async ({ page }) => { await page.goto('/'); await page.waitForSelector(`text=tRPC user`); });
4,841
0
petrpan-code/trpc/trpc/examples/next-prisma-starter
petrpan-code/trpc/trpc/examples/next-prisma-starter/playwright/smoke.test.ts
import { test, expect } from '@playwright/test'; test.setTimeout(35e3); test('go to /', async ({ page }) => { await page.goto('/'); await page.waitForSelector(`text=Starter`); }); test('test 404', async ({ page }) => { const res = await page.goto('/post/not-found'); expect(res?.status()).toBe(404); }); tes...
4,861
0
petrpan-code/trpc/trpc/examples/next-prisma-starter/src/server
petrpan-code/trpc/trpc/examples/next-prisma-starter/src/server/routers/post.test.ts
/** * Integration test example for the `post` router */ import { createContextInner } from '../context'; import { AppRouter, appRouter } from './_app'; import { inferProcedureInput } from '@trpc/server'; test('add and get post', async () => { const ctx = await createContextInner({}); const caller = appRouter.cre...
4,893
0
petrpan-code/trpc/trpc/examples/next-prisma-todomvc
petrpan-code/trpc/trpc/examples/next-prisma-todomvc/test/playwright.test.ts
import { test } from '@playwright/test'; test.setTimeout(35e3); test('add todo', async ({ page }) => { await page.goto('/'); const nonce = Math.random() .toString(36) .replace(/[^a-z]+/g, '') .slice(0, 6); await page.type('.new-todo', nonce); await page.keyboard.press('Enter'); await page.waitF...
4,934
0
petrpan-code/trpc/trpc/examples/next-prisma-websockets-starter
petrpan-code/trpc/trpc/examples/next-prisma-websockets-starter/test/playwright.test.ts
import { test } from '@playwright/test'; test.setTimeout(35e3); test('send message', async ({ browser, page }) => { const viewer = await browser.newPage(); await viewer.goto('/'); await page.goto('/api/auth/signin'); await page.type('[name="name"]', 'test'); await page.click('[type="submit"]'); const no...
4,977
0
petrpan-code/trpc/trpc/packages/client/src
petrpan-code/trpc/trpc/packages/client/src/internals/types.test.ts
import isomorphicFetch from 'isomorphic-fetch'; import nodeFetch from 'node-fetch'; import type { fetch as undiciFetch } from 'undici'; import { createTRPCProxyClient } from '../createTRPCClientProxy'; import { getFetch } from '../getFetch'; import { httpBatchLink } from '../links/httpBatchLink'; import { getAbortContr...
4,986
0
petrpan-code/trpc/trpc/packages/client/src
petrpan-code/trpc/trpc/packages/client/src/links/splitLink.test.ts
import { observable } from '@trpc/server/observable'; import { OperationLink, splitLink, TRPCLink } from '../'; import { AnyRouter } from '../../../server/src'; import { createChain } from '../links/internals/createChain'; test('splitLink', () => { const wsLinkSpy = vi.fn(); const wsLink: TRPCLink<any> = () => () ...
4,990
0
petrpan-code/trpc/trpc/packages/client/src/links
petrpan-code/trpc/trpc/packages/client/src/links/internals/createChain.test.ts
import { observable } from '@trpc/server/observable'; import { AnyRouter } from '@trpc/server/src'; import { createChain } from './createChain'; describe('chain', () => { test('trivial', () => { const result$ = createChain<AnyRouter, unknown, unknown>({ links: [ ({ next, op }) => { return...
4,993
0
petrpan-code/trpc/trpc/packages/client/src/links
petrpan-code/trpc/trpc/packages/client/src/links/internals/dedupeLink.test.ts
import { waitFor } from '@testing-library/dom'; import { AnyRouter } from '@trpc/server/src'; import { observable } from '@trpc/server/src/observable'; import { OperationLink } from '../..'; import { createChain } from './createChain'; import { dedupeLink } from './dedupeLink'; test('dedupeLink', async () => { const...
4,997
0
petrpan-code/trpc/trpc/packages/client/src/links
petrpan-code/trpc/trpc/packages/client/src/links/internals/parseJSONStream.test.ts
import { parseJSONStream } from './parseJSONStream'; describe('parseJsonStream', () => { test('multiline streamed JSON', async () => { const encoder = new TextEncoder(); const stream = new ReadableStream<Uint8Array>({ start(controller) { const enqueue = (chunk: string) => { controller...
5,012
0
petrpan-code/trpc/trpc/packages/next/src
petrpan-code/trpc/trpc/packages/next/src/app-dir/client.test.tsx
import { render, waitFor } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import { initTRPC } from '@trpc/server'; import React from 'react'; import superjson from 'superjson'; import { z } from 'zod'; import { experimental_createActionHook, experimental_serverActionLink, UseT...
5,015
0
petrpan-code/trpc/trpc/packages/next/src
petrpan-code/trpc/trpc/packages/next/src/app-dir/formDataToObject.test.ts
import { formDataToObject } from './formDataToObject'; test('basic', () => { const formData = new FormData(); formData.append('foo', 'bar'); expect(formDataToObject(formData)).toEqual({ foo: 'bar', }); }); test('multiple values on the same key', () => { const formData = new FormData(); formData.app...
5,032
0
petrpan-code/trpc/trpc/packages/react-query/src
petrpan-code/trpc/trpc/packages/react-query/src/internals/getArrayQueryKey.test.ts
import { getArrayQueryKey } from './getArrayQueryKey'; test('getArrayQueryKey', () => { // empty path should not nest an extra array expect(getArrayQueryKey('', 'any')).toMatchInlineSnapshot(`Array []`); // should not nest an empty object expect(getArrayQueryKey('foo', 'any')).toMatchInlineSnapshot(` Arra...
5,092
0
petrpan-code/trpc/trpc/packages/server/src/adapters/node-http/content-type
petrpan-code/trpc/trpc/packages/server/src/adapters/node-http/content-type/json/getPostBody.test.ts
import { EventEmitter } from 'events'; import { getPostBody } from './getPostBody'; test('has body', async () => { const body = {}; const resolvedBody = await getPostBody({ req: { body, headers: { 'content-type': 'application/json', }, }, } as any); expect(resolvedBody).toMatc...
5,117
0
petrpan-code/trpc/trpc/packages/server/src
petrpan-code/trpc/trpc/packages/server/src/http/batchStreamFormatter.test.ts
import { getBatchStreamFormatter } from './batchStreamFormatter'; test('getBatchStreamFormatter', () => { const formatter = getBatchStreamFormatter(); expect(formatter(1, '{"foo": "bar"}')).toBe(`{"1":{"foo": "bar"}\n`); expect(formatter(0, '{"q": "a"}')).toBe(`,"0":{"q": "a"}\n`); expect(formatter(2, '{"hello...
5,128
0
petrpan-code/trpc/trpc/packages/server/src
petrpan-code/trpc/trpc/packages/server/src/observable/observable.test.ts
import { observable, share, tap } from '.'; test('vanilla observable - complete()', () => { const obs = observable<number, Error>((observer) => { observer.next(1); observer.complete(); }); const next = vi.fn(); const error = vi.fn(); const complete = vi.fn(); obs.subscribe({ next, error, ...
5,135
0
petrpan-code/trpc/trpc/packages/server/src/observable
petrpan-code/trpc/trpc/packages/server/src/observable/operators/map.test.ts
import { EventEmitter } from 'events'; import { map } from '.'; import { observable } from '../observable'; interface SubscriptionEvents<TOutput> { data: (data: TOutput) => void; } declare interface CustomEventEmitter<TOutput> { on<U extends keyof SubscriptionEvents<TOutput>>( event: U, listener: Subscrip...
5,137
0
petrpan-code/trpc/trpc/packages/server/src/observable
petrpan-code/trpc/trpc/packages/server/src/observable/operators/share.test.ts
/* eslint-disable no-var */ import { observable } from '../observable'; import { share } from './share'; test('share', () => { const obs = share()( observable<number, Error>((observer) => { observer.next(1); }), ); { const next = vi.fn(); const error = vi.fn(); const complete = vi.fn()...
5,155
0
petrpan-code/trpc/trpc/packages/tests
petrpan-code/trpc/trpc/packages/tests/server/TRPCError.test.ts
import { getTRPCErrorFromUnknown, TRPCError } from '@trpc/server/src'; test('should extend original Error class', () => { const trpcError = new TRPCError({ code: 'FORBIDDEN' }); expect(trpcError).toBeInstanceOf(TRPCError); expect(trpcError).toBeInstanceOf(Error); }); test('should populate name field using the c...
5,159
0
petrpan-code/trpc/trpc/packages/tests
petrpan-code/trpc/trpc/packages/tests/server/abortQuery.test.ts
import { routerToServerAndClientNew, waitMs } from './___testHelpers'; import { initTRPC } from '@trpc/server/src/core'; const t = initTRPC.create(); const router = t.router({ testQuery: t.procedure.query(async () => { await waitMs(1000); return 'hello'; }), testMutation: t.procedure.mutation(async () =...
5,160
0
petrpan-code/trpc/trpc/packages/tests
petrpan-code/trpc/trpc/packages/tests/server/callRouter.test.ts
import './___packages'; import { initTRPC } from '@trpc/server'; test('deprecated: call proc directly', async () => { const t = initTRPC.create(); const router = t.router({ sub: t.router({ hello: t.procedure.query(() => 'hello'), }), }); const result = await router.sub.hello({ ctx: {}, p...
5,161
0
petrpan-code/trpc/trpc/packages/tests
petrpan-code/trpc/trpc/packages/tests/server/caller.test.ts
import { waitError } from './___testHelpers'; import { initTRPC, TRPCError } from '@trpc/server/src'; import { z } from 'zod'; const t = initTRPC .context<{ foo?: 'bar'; }>() .create(); const { procedure } = t; test('undefined input query', async () => { const router = t.router({ hello: procedure.que...
5,162
0
petrpan-code/trpc/trpc/packages/tests
petrpan-code/trpc/trpc/packages/tests/server/children.test.ts
import { routerToServerAndClientNew } from './___testHelpers'; import { initTRPC } from '@trpc/server/src'; test('children', async () => { const t = initTRPC.create(); const router = t.router({ foo: t.procedure.query(() => 'bar'), child: t.router({ childQuery: t.procedure.query(() => 'asd'), g...
5,163
0
petrpan-code/trpc/trpc/packages/tests
petrpan-code/trpc/trpc/packages/tests/server/clientInternals.test.ts
import { getFetch } from '@trpc/client/src'; import { getAbortController } from '@trpc/client/src/internals/getAbortController'; describe('getAbortController() from..', () => { test('passed', () => { const sym: any = Symbol('test'); expect(getAbortController(sym)).toBe(sym); }); test('window', () => { ...
5,164
0
petrpan-code/trpc/trpc/packages/tests
petrpan-code/trpc/trpc/packages/tests/server/concat.test.ts
import { routerToServerAndClientNew } from './___testHelpers'; import { initTRPC, TRPCError } from '@trpc/server/src'; import { konn } from 'konn'; type User = { id: string; name: string; }; type Context = { user: User | null; }; const mockUser: User = { id: '123', name: 'John Doe', }; const ctx = konn() ....
5,165
0
petrpan-code/trpc/trpc/packages/tests
petrpan-code/trpc/trpc/packages/tests/server/createClient.test.ts
import './___packages'; import { createTRPCProxyClient, httpBatchLink } from '@trpc/client'; global.fetch = vi.fn() as any; describe('typedefs on createClient', () => { test('ok to pass only links', () => { createTRPCProxyClient({ links: [httpBatchLink({ url: 'foo' })], }); }); test('error if bot...
5,166
0
petrpan-code/trpc/trpc/packages/tests
petrpan-code/trpc/trpc/packages/tests/server/createUntypedClient.test.ts
import { ignoreErrors } from './___testHelpers'; import { createTRPCUntypedClient } from '@trpc/client/src'; import { Unsubscribable } from '@trpc/server/src/observable'; test('loosely typed parameters', () => { const client = createTRPCUntypedClient({ links: [], }); ignoreErrors(async () => { const _ar...
5,167
0
petrpan-code/trpc/trpc/packages/tests
petrpan-code/trpc/trpc/packages/tests/server/dataloader.test.ts
/* eslint-disable @typescript-eslint/no-empty-function */ import { waitError, waitMs } from './___testHelpers'; import { dataLoader } from '@trpc/client/src/internals/dataLoader'; describe('basic', () => { const fetchFn = vi.fn(); const validateFn = vi.fn(); const loader = dataLoader<number, number>({ valida...
5,168
0
petrpan-code/trpc/trpc/packages/tests
petrpan-code/trpc/trpc/packages/tests/server/errorFormatting.test.ts
import { routerToServerAndClientNew, waitError } from './___testHelpers'; import { TRPCClientError } from '@trpc/client'; import { AnyRouter, DefaultErrorShape, initTRPC, TRPCError, } from '@trpc/server'; import { DefaultErrorData } from '@trpc/server/src/error/formatter'; import { konn } from 'konn'; import { ...
5,169
0
petrpan-code/trpc/trpc/packages/tests
petrpan-code/trpc/trpc/packages/tests/server/errors.test.ts
/* eslint-disable @typescript-eslint/no-empty-function */ import http from 'http'; import { routerToServerAndClientNew, waitError } from './___testHelpers'; import { createTRPCProxyClient, httpBatchLink, httpLink, TRPCClientError, TRPCLink, } from '@trpc/client/src'; import { observable } from '@trpc/server/o...
5,170
0
petrpan-code/trpc/trpc/packages/tests
petrpan-code/trpc/trpc/packages/tests/server/getUntypedClient.test.ts
import { getUntypedClient, TRPCUntypedClient } from '@trpc/client'; import { AnyRouter, initTRPC } from '@trpc/server'; import { konn } from 'konn'; import './___packages'; import { routerToServerAndClientNew } from './___testHelpers'; const ctx = konn() .beforeEach(() => { const t = initTRPC.create(); cons...
5,171
0
petrpan-code/trpc/trpc/packages/tests
petrpan-code/trpc/trpc/packages/tests/server/headers.test.tsx
import { routerToServerAndClientNew } from './___testHelpers'; import { createTRPCProxyClient, httpBatchLink, httpLink, } from '@trpc/client/src'; import { Dict, initTRPC } from '@trpc/server/src'; describe('pass headers', () => { type Context = { headers: Dict<string[] | string>; }; const t = initTRP...
5,172
0
petrpan-code/trpc/trpc/packages/tests
petrpan-code/trpc/trpc/packages/tests/server/index.test.ts
/* eslint-disable @typescript-eslint/no-empty-function */ import { routerToServerAndClientNew, waitError } from './___testHelpers'; import { waitFor } from '@testing-library/react'; import { createTRPCProxyClient, createWSClient, httpBatchLink, HTTPHeaders, TRPCClientError, wsLink, } from '@trpc/client/src'...
5,173
0
petrpan-code/trpc/trpc/packages/tests
petrpan-code/trpc/trpc/packages/tests/server/inferenceHelpers.test.ts
import { inferRouterInputs, inferRouterOutputs, initTRPC } from '@trpc/server'; import { z } from 'zod'; const t = initTRPC.create(); const roomProcedure = t.procedure.input( z.object({ roomId: z.string(), }), ); const appRouter = t.router({ getRoom: roomProcedure.query(({ input }) => { return { id...
5,174
0
petrpan-code/trpc/trpc/packages/tests
petrpan-code/trpc/trpc/packages/tests/server/initTRPC.test.ts
import { DataTransformerOptions, DefaultDataTransformer, initTRPC, } from '@trpc/server/src'; test('default transformer', () => { const t = initTRPC .context<{ foo: 'bar'; }>() .create(); const router = t.router({}); expectTypeOf<typeof router._def._config.$types.ctx>().toMatchTypeOf<{ ...
5,175
0
petrpan-code/trpc/trpc/packages/tests
petrpan-code/trpc/trpc/packages/tests/server/input.test.ts
import { routerToServerAndClientNew, waitError } from './___testHelpers'; import { createTRPCProxyClient, TRPCClientError } from '@trpc/client'; import { inferProcedureInput, inferProcedureParams, initTRPC, } from '@trpc/server'; import { UnsetMarker } from '@trpc/server/core/internals/utils'; import { konn } fro...
5,176
0
petrpan-code/trpc/trpc/packages/tests
petrpan-code/trpc/trpc/packages/tests/server/isDev.test.ts
import { routerToServerAndClientNew, waitError } from './___testHelpers'; import { TRPCClientError } from '@trpc/client/src'; import { initTRPC } from '@trpc/server/src'; import { konn } from 'konn'; const createTestContext = (opts: { isDev: boolean }) => konn() .beforeEach(() => { const t = initTRPC.creat...
5,177
0
petrpan-code/trpc/trpc/packages/tests
petrpan-code/trpc/trpc/packages/tests/server/jsonify.test.ts
import { routerToServerAndClientNew } from './___testHelpers'; import { initTRPC } from '@trpc/server'; import { konn } from 'konn'; import superjson from 'superjson'; describe('no transformer specified', () => { const ctx = konn() .beforeEach(() => { const t = initTRPC.create(); const appRouter = t...
5,178
0
petrpan-code/trpc/trpc/packages/tests
petrpan-code/trpc/trpc/packages/tests/server/links.test.ts
import { routerToServerAndClientNew } from './___testHelpers'; import { createTRPCProxyClient, httpBatchLink, httpLink, loggerLink, OperationLink, TRPCClientError, TRPCClientRuntime, unstable_httpBatchStreamLink, } from '@trpc/client/src'; import { createChain } from '@trpc/client/src/links/internals/cr...
5,179
0
petrpan-code/trpc/trpc/packages/tests
petrpan-code/trpc/trpc/packages/tests/server/meta.test.ts
import { routerToServerAndClientNew } from './___testHelpers'; import { initTRPC } from '@trpc/server/src'; import { konn } from 'konn'; test('meta is undefined in a middleware', () => { type Meta = { permissions: string[]; }; const t = initTRPC.meta<Meta>().create(); t.middleware((opts) => { expectTy...
5,180
0
petrpan-code/trpc/trpc/packages/tests
petrpan-code/trpc/trpc/packages/tests/server/middlewares.test.ts
import { experimental_standaloneMiddleware, initTRPC, TRPCError, } from '@trpc/server/src'; import * as z from 'zod'; test('decorate independently', () => { type User = { id: string; name: string; }; type Context = { user: User; }; const t = initTRPC.context<Context>().create(); const fo...
5,181
0
petrpan-code/trpc/trpc/packages/tests
petrpan-code/trpc/trpc/packages/tests/server/outputParser.test.ts
import { routerToServerAndClientNew } from './___testHelpers'; import { wrap } from '@decs/typeschema'; import { initTRPC } from '@trpc/server/src'; import myzod from 'myzod'; import * as t from 'superstruct'; import * as v from 'valibot'; import * as yup from 'yup'; import { z } from 'zod'; test('zod', async () => { ...
5,182
0
petrpan-code/trpc/trpc/packages/tests
petrpan-code/trpc/trpc/packages/tests/server/rawFetch.test.tsx
import { routerToServerAndClientNew } from './___testHelpers'; import { initTRPC } from '@trpc/server/src'; import { z } from 'zod'; const factory = () => { const t = initTRPC.context().create(); const router = t.router({ myQuery: t.procedure .input( z .object({ name: z.str...
5,183
0
petrpan-code/trpc/trpc/packages/tests
petrpan-code/trpc/trpc/packages/tests/server/responseMeta.test.ts
import { IncomingMessage, ServerResponse } from 'http'; import { routerToServerAndClientNew } from './___testHelpers'; import { initTRPC } from '@trpc/server/src'; import fetch from 'node-fetch'; test('set custom headers in beforeEnd', async () => { const onError = vi.fn(); interface Context { req: IncomingMe...
5,184
0
petrpan-code/trpc/trpc/packages/tests
petrpan-code/trpc/trpc/packages/tests/server/router.test.ts
import './___packages'; import { initTRPC } from '@trpc/server/src/core'; const t = initTRPC.create(); describe('router', () => { test('is a reserved word', async () => { expect(() => { return t.router({ then: t.procedure.query(() => 'hello'), }); }).toThrowErrorMatchingInlineSnapshot( ...
5,185
0
petrpan-code/trpc/trpc/packages/tests
petrpan-code/trpc/trpc/packages/tests/server/routerMeta.test.ts
import { routerToServerAndClientNew } from './___testHelpers'; import { inferRouterMeta, initTRPC } from '@trpc/server/src'; import { observable } from '@trpc/server/src/observable'; test('route meta types', async () => { const testMeta = { data: 'foo' }; const t = initTRPC.meta<typeof testMeta>().create(); cons...
5,186
0
petrpan-code/trpc/trpc/packages/tests
petrpan-code/trpc/trpc/packages/tests/server/smoke.test.ts
import { EventEmitter } from 'events'; import { routerToServerAndClientNew, waitError } from './___testHelpers'; import { waitFor } from '@testing-library/react'; import { TRPCClientError, wsLink } from '@trpc/client/src'; import { inferProcedureParams, initTRPC } from '@trpc/server/src'; import { observable, Unsubscri...
5,187
0
petrpan-code/trpc/trpc/packages/tests
petrpan-code/trpc/trpc/packages/tests/server/streaming.test.ts
import { routerToServerAndClientNew } from './___testHelpers'; import { TRPCLink, unstable_httpBatchStreamLink } from '@trpc/client'; import { initTRPC, TRPCError } from '@trpc/server'; import { observable } from '@trpc/server/observable'; import { konn } from 'konn'; import superjson from 'superjson'; import { z } fro...
5,188
0
petrpan-code/trpc/trpc/packages/tests
petrpan-code/trpc/trpc/packages/tests/server/transformer.test.ts
import { routerToServerAndClientNew, waitError } from './___testHelpers'; import { createTRPCProxyClient, createWSClient, httpBatchLink, httpLink, TRPCClientError, wsLink, } from '@trpc/client'; import { CombinedDataTransformer, DataTransformer, initTRPC, TRPCError, } from '@trpc/server'; import { o...
5,189
0
petrpan-code/trpc/trpc/packages/tests
petrpan-code/trpc/trpc/packages/tests/server/validators.test.ts
import { routerToServerAndClientNew } from './___testHelpers'; import { wrap } from '@decs/typeschema'; import * as S from '@effect/schema/Schema'; import { initTRPC } from '@trpc/server/src'; import * as arktype from 'arktype'; import myzod from 'myzod'; import * as T from 'runtypes'; import * as $ from 'scale-codec';...
5,190
0
petrpan-code/trpc/trpc/packages/tests
petrpan-code/trpc/trpc/packages/tests/server/websockets.test.ts
import { EventEmitter } from 'events'; import { routerToServerAndClientNew, waitMs } from './___testHelpers'; import { waitFor } from '@testing-library/react'; import { createWSClient, TRPCClientError, wsLink } from '@trpc/client/src'; import { AnyRouter, initTRPC, TRPCError } from '@trpc/server/src'; import { applyWSS...
5,192
0
petrpan-code/trpc/trpc/packages/tests/server
petrpan-code/trpc/trpc/packages/tests/server/adapters/awsLambda.test.tsx
import { initTRPC } from '@trpc/server/src'; import * as trpcLambda from '@trpc/server/src/adapters/aws-lambda'; import type { APIGatewayProxyEvent, APIGatewayProxyEventV2 } from 'aws-lambda'; import { z } from 'zod'; import { mockAPIGatewayContext, mockAPIGatewayProxyEventBase64Encoded, mockAPIGatewayProxyEventV...
5,193
0
petrpan-code/trpc/trpc/packages/tests/server
petrpan-code/trpc/trpc/packages/tests/server/adapters/express.test.tsx
import http from 'http'; import { Context, router } from './__router'; import { createTRPCProxyClient, httpBatchLink, TRPCClientError, } from '@trpc/client/src'; import * as trpc from '@trpc/server/src'; import * as trpcExpress from '@trpc/server/src/adapters/express'; import express from 'express'; import fetch ...
5,194
0
petrpan-code/trpc/trpc/packages/tests/server
petrpan-code/trpc/trpc/packages/tests/server/adapters/fastify.test.ts
import { EventEmitter } from 'events'; import ws from '@fastify/websocket'; import { waitFor } from '@testing-library/react'; import { createTRPCProxyClient, createWSClient, HTTPHeaders, splitLink, TRPCLink, unstable_httpBatchStreamLink, wsLink, } from '@trpc/client/src'; import { initTRPC } from '@trpc/s...
5,195
0
petrpan-code/trpc/trpc/packages/tests/server
petrpan-code/trpc/trpc/packages/tests/server/adapters/fetch.test.ts
// @vitest-environment miniflare /// <reference types="@cloudflare/workers-types" /> import '../___packages'; import { ReadableStream as MiniflareReadableStream } from 'stream/web'; import { Response as MiniflareResponse } from '@miniflare/core'; import { createTRPCProxyClient, httpBatchLink, TRPCLink, unstable...
5,196
0
petrpan-code/trpc/trpc/packages/tests/server
petrpan-code/trpc/trpc/packages/tests/server/adapters/lambda.test.tsx
/** * @deprecated * TODO: remove in next major */ import * as trpc from '@trpc/server/src'; import * as trpcLambda from '@trpc/server/src/adapters/lambda'; import type { APIGatewayProxyEvent, APIGatewayProxyEventV2 } from 'aws-lambda'; import { z } from 'zod'; import { mockAPIGatewayContext, mockAPIGatewayProxyE...
5,198
0
petrpan-code/trpc/trpc/packages/tests/server
petrpan-code/trpc/trpc/packages/tests/server/adapters/next.test.ts
import { EventEmitter } from 'events'; import { initTRPC } from '@trpc/server'; import * as trpcNext from '@trpc/server/src/adapters/next'; function mockReq({ query, method = 'GET', body, }: { query: Record<string, any>; method?: | 'CONNECT' | 'DELETE' | 'GET' | 'HEAD' | 'OPTIONS' | '...
5,199
0
petrpan-code/trpc/trpc/packages/tests/server
petrpan-code/trpc/trpc/packages/tests/server/adapters/standalone.test.ts
import { createTRPCProxyClient, httpBatchLink, TRPCClientError, } from '@trpc/client/src'; import { initTRPC, TRPCError } from '@trpc/server'; import { CreateHTTPHandlerOptions, createHTTPServer, } from '@trpc/server/src/adapters/standalone'; import fetch from 'node-fetch'; import { z } from 'zod'; const t =...