level_0
int64
0
10k
index
int64
0
0
repo_id
stringlengths
22
152
file_path
stringlengths
41
203
content
stringlengths
11
11.5M
1,140
0
petrpan-code/storybookjs/storybook/code/lib/preview-api/src/modules
petrpan-code/storybookjs/storybook/code/lib/preview-api/src/modules/preview-web/UrlStore.test.ts
import { global } from '@storybook/global'; import { pathToId, setPath, getSelectionSpecifierFromPath } from './UrlStore'; const { history, document } = global; jest.mock('@storybook/global', () => ({ global: { history: { replaceState: jest.fn() }, document: { location: { pathname: 'pathname'...
1,145
0
petrpan-code/storybookjs/storybook/code/lib/preview-api/src/modules
petrpan-code/storybookjs/storybook/code/lib/preview-api/src/modules/preview-web/parseArgsParam.test.ts
import { parseArgsParam } from './parseArgsParam'; jest.mock('@storybook/client-logger', () => ({ once: { warn: jest.fn() }, })); describe('parseArgsParam', () => { it('parses a simple key-value pair', () => { const args = parseArgsParam('key:val'); expect(args).toStrictEqual({ key: 'val' }); }); it(...
1,147
0
petrpan-code/storybookjs/storybook/code/lib/preview-api/src/modules
petrpan-code/storybookjs/storybook/code/lib/preview-api/src/modules/preview-web/simulate-pageload.test.ts
/** * @jest-environment jsdom */ import { global } from '@storybook/global'; import { simulatePageLoad } from './simulate-pageload'; const { document } = global; describe('simulatePageLoad', () => { it('should add script with type module to scripts root', () => { const container = document.createElement('div...
1,149
0
petrpan-code/storybookjs/storybook/code/lib/preview-api/src/modules/preview-web
petrpan-code/storybookjs/storybook/code/lib/preview-api/src/modules/preview-web/docs-context/DocsContext.test.ts
import { Channel } from '@storybook/channels'; import type { CSFFile, Renderer } from '@storybook/types'; import type { StoryStore } from '../../store'; import { DocsContext } from './DocsContext'; import { csfFileParts } from './test-utils'; const channel = new Channel({}); const renderStoryToElement = jest.fn(); d...
1,154
0
petrpan-code/storybookjs/storybook/code/lib/preview-api/src/modules/preview-web
petrpan-code/storybookjs/storybook/code/lib/preview-api/src/modules/preview-web/render/CsfDocsRender.test.ts
import { Channel } from '@storybook/channels'; import type { Renderer, DocsIndexEntry, RenderContextCallbacks } from '@storybook/types'; import type { StoryStore } from '../../store'; import { PREPARE_ABORTED } from './Render'; import { CsfDocsRender } from './CsfDocsRender'; import { csfFileParts } from '../docs-cont...
1,156
0
petrpan-code/storybookjs/storybook/code/lib/preview-api/src/modules/preview-web
petrpan-code/storybookjs/storybook/code/lib/preview-api/src/modules/preview-web/render/MdxDocsRender.test.ts
import { Channel } from '@storybook/channels'; import type { Renderer, DocsIndexEntry, RenderContextCallbacks } from '@storybook/types'; import type { StoryStore } from '../../store'; import { PREPARE_ABORTED } from './Render'; import { MdxDocsRender } from './MdxDocsRender'; import { csfFileParts } from '../docs-cont...
1,159
0
petrpan-code/storybookjs/storybook/code/lib/preview-api/src/modules/preview-web
petrpan-code/storybookjs/storybook/code/lib/preview-api/src/modules/preview-web/render/StoryRender.test.ts
import { Channel } from '@storybook/channels'; import type { Renderer, StoryIndexEntry } from '@storybook/types'; import type { StoryStore } from '../../store'; import { PREPARE_ABORTED } from './Render'; import { StoryRender } from './StoryRender'; const entry = { type: 'story', id: 'component--a', name: 'A', ...
1,161
0
petrpan-code/storybookjs/storybook/code/lib/preview-api/src/modules
petrpan-code/storybookjs/storybook/code/lib/preview-api/src/modules/store/ArgsStore.test.ts
import { expect } from '@jest/globals'; import { ArgsStore } from './ArgsStore'; jest.mock('@storybook/client-logger'); const stringType = { type: { name: 'string' } }; const booleanType = { type: { name: 'boolean' } }; describe('ArgsStore', () => { describe('setInitial / get', () => { it('returns in a straig...
1,163
0
petrpan-code/storybookjs/storybook/code/lib/preview-api/src/modules
petrpan-code/storybookjs/storybook/code/lib/preview-api/src/modules/store/GlobalsStore.test.ts
import { expect } from '@jest/globals'; import { GlobalsStore } from './GlobalsStore'; jest.mock('@storybook/client-logger', () => ({ logger: { warn: jest.fn(), }, })); describe('GlobalsStore', () => { it('is initialized to the value in globals', () => { const store = new GlobalsStore({ globals: {...
1,165
0
petrpan-code/storybookjs/storybook/code/lib/preview-api/src/modules
petrpan-code/storybookjs/storybook/code/lib/preview-api/src/modules/store/StoryIndexStore.test.ts
import { expect } from '@jest/globals'; import type { StoryIndex } from '@storybook/types'; import { StoryIndexStore } from './StoryIndexStore'; jest.mock('@storybook/channel-websocket', () => () => ({ on: jest.fn() })); const storyIndex: StoryIndex = { v: 4, entries: { 'component-one--a': { type: 'sto...
1,167
0
petrpan-code/storybookjs/storybook/code/lib/preview-api/src/modules
petrpan-code/storybookjs/storybook/code/lib/preview-api/src/modules/store/StoryStore.test.ts
import type { Renderer, ProjectAnnotations, StoryIndex } from '@storybook/types'; import { expect } from '@jest/globals'; import { prepareStory } from './csf/prepareStory'; import { processCSFFile } from './csf/processCSFFile'; import { StoryStore } from './StoryStore'; import type { HooksContext } from './hooks'; //...
1,169
0
petrpan-code/storybookjs/storybook/code/lib/preview-api/src/modules
petrpan-code/storybookjs/storybook/code/lib/preview-api/src/modules/store/args.test.ts
import { once } from '@storybook/client-logger'; import { expect } from '@jest/globals'; import type { SBType } from '@storybook/types'; import { combineArgs, groupArgsByTarget, mapArgsToTypes, UNTARGETED, validateOptions, } from './args'; const stringType: SBType = { name: 'string' }; const numberType: SBT...
1,171
0
petrpan-code/storybookjs/storybook/code/lib/preview-api/src/modules
petrpan-code/storybookjs/storybook/code/lib/preview-api/src/modules/store/autoTitle.test.ts
import { normalizeStoriesEntry } from '@storybook/core-common'; import { expect } from '@jest/globals'; import { userOrAutoTitleFromSpecifier as userOrAuto } from './autoTitle'; expect.addSnapshotSerializer({ print: (val: any) => val, test: (val: any) => true, }); // Make these two the same so `normalizeStoriesE...
1,173
0
petrpan-code/storybookjs/storybook/code/lib/preview-api/src/modules
petrpan-code/storybookjs/storybook/code/lib/preview-api/src/modules/store/decorators.test.ts
import { expect } from '@jest/globals'; import type { Renderer, StoryContext } from '@storybook/types'; import { defaultDecorateStory } from './decorators'; function makeContext(input: Record<string, any> = {}): StoryContext<Renderer> { return { id: 'id', kind: 'kind', name: 'name', viewMode: 'story...
1,176
0
petrpan-code/storybookjs/storybook/code/lib/preview-api/src/modules
petrpan-code/storybookjs/storybook/code/lib/preview-api/src/modules/store/hooks.test.ts
import { expect } from '@jest/globals'; import { FORCE_RE_RENDER, STORY_RENDERED, UPDATE_STORY_ARGS, RESET_STORY_ARGS, UPDATE_GLOBALS, } from '@storybook/core-events'; import type { DecoratorFunction, StoryContext } from '@storybook/types'; import { addons, applyHooks, useEffect, useMemo, useCallbac...
1,179
0
petrpan-code/storybookjs/storybook/code/lib/preview-api/src/modules
petrpan-code/storybookjs/storybook/code/lib/preview-api/src/modules/store/inferArgTypes.test.ts
import { logger } from '@storybook/client-logger'; import { expect } from '@jest/globals'; import { inferArgTypes } from './inferArgTypes'; jest.mock('@storybook/client-logger'); describe('inferArgTypes', () => { it('infers scalar types', () => { expect( inferArgTypes({ initialArgs: { a...
1,181
0
petrpan-code/storybookjs/storybook/code/lib/preview-api/src/modules
petrpan-code/storybookjs/storybook/code/lib/preview-api/src/modules/store/inferControls.test.ts
import { expect } from '@jest/globals'; import { logger } from '@storybook/client-logger'; import type { StoryContextForEnhancers } from '@storybook/types'; import { argTypesEnhancers } from './inferControls'; const getStoryContext = (overrides: any = {}): StoryContextForEnhancers => ({ id: '', title: '', kind:...
1,183
0
petrpan-code/storybookjs/storybook/code/lib/preview-api/src/modules
petrpan-code/storybookjs/storybook/code/lib/preview-api/src/modules/store/parameters.test.ts
import { expect } from '@jest/globals'; import { combineParameters } from './parameters'; describe('client-api.parameters', () => { it('merges different sets of parameters by key, preferencing last', () => { expect(combineParameters({ a: 'b', c: 'd' }, { e: 'f', a: 'g' })).toEqual({ a: 'g', c: 'd', ...
1,186
0
petrpan-code/storybookjs/storybook/code/lib/preview-api/src/modules
petrpan-code/storybookjs/storybook/code/lib/preview-api/src/modules/store/storySort.test.ts
import { expect, describe, it } from '@jest/globals'; import type { StoryId, StoryIndexEntry } from '@storybook/types'; import { storySort } from './storySort'; describe('preview.storySort', () => { const fixture: Record<StoryId, StoryIndexEntry> = Object.fromEntries( Object.entries({ a: { title: 'a' }, ...
1,188
0
petrpan-code/storybookjs/storybook/code/lib/preview-api/src/modules/store
petrpan-code/storybookjs/storybook/code/lib/preview-api/src/modules/store/csf/composeConfigs.test.ts
import { expect } from '@jest/globals'; import { global } from '@storybook/global'; import { composeConfigs } from './composeConfigs'; jest.mock('@storybook/global', () => ({ global: { FEATURES: {}, }, })); describe('composeConfigs', () => { it('sets default (empty) values for fields', () => { expect(c...
1,194
0
petrpan-code/storybookjs/storybook/code/lib/preview-api/src/modules/store
petrpan-code/storybookjs/storybook/code/lib/preview-api/src/modules/store/csf/normalizeInputTypes.test.ts
import { expect } from '@jest/globals'; import { normalizeInputType, normalizeInputTypes } from './normalizeInputTypes'; describe('normalizeInputType', () => { it('does nothing to strict types', () => { expect( normalizeInputType( { name: 'name', type: { name: 'string' }, ...
1,197
0
petrpan-code/storybookjs/storybook/code/lib/preview-api/src/modules/store
petrpan-code/storybookjs/storybook/code/lib/preview-api/src/modules/store/csf/normalizeStory.test.ts
import { expect, describe, it } from '@jest/globals'; import type { Renderer, StoryAnnotationsOrFn } from '@storybook/types'; import { normalizeStory } from './normalizeStory'; describe('normalizeStory', () => { describe('id generation', () => { it('respects component id', () => { expect(normalizeStory('n...
1,199
0
petrpan-code/storybookjs/storybook/code/lib/preview-api/src/modules/store
petrpan-code/storybookjs/storybook/code/lib/preview-api/src/modules/store/csf/prepareStory.test.ts
/// <reference types="@types/jest" />; import { global } from '@storybook/global'; import { expect } from '@jest/globals'; import type { Renderer, ArgsEnhancer, PlayFunctionContext, SBScalarType } from '@storybook/types'; import { addons, HooksContext } from '../../addons'; import { UNTARGETED } from '../args'; impor...
1,201
0
petrpan-code/storybookjs/storybook/code/lib/preview-api/src/modules/store
petrpan-code/storybookjs/storybook/code/lib/preview-api/src/modules/store/csf/processCSFFile.test.ts
import { expect } from '@jest/globals'; import { processCSFFile } from './processCSFFile'; it('returns a CSFFile object with meta and stories', () => { const { meta, stories } = processCSFFile( { default: { title: 'Component' }, storyOne: { args: { a: 1 } }, storyTwo: { args: { a: 2 } }, }...
1,203
0
petrpan-code/storybookjs/storybook/code/lib/preview-api/src/modules/store
petrpan-code/storybookjs/storybook/code/lib/preview-api/src/modules/store/csf/stepRunners.test.ts
import type { PlayFunctionContext, StepRunner } from '@storybook/types'; import { composeStepRunners } from './stepRunners'; describe('stepRunners', () => { it('composes each step runner', async () => { const order: string[] = []; const firstStepRunner: StepRunner = async (label, play, ctx) => { order...
1,205
0
petrpan-code/storybookjs/storybook/code/lib/preview-api/src/modules/store/csf
petrpan-code/storybookjs/storybook/code/lib/preview-api/src/modules/store/csf/testing-utils/index.test.ts
import { composeStory, composeStories } from './index'; // Most integration tests for this functionality are located under renderers/react describe('composeStory', () => { const meta = { title: 'Button', parameters: { firstAddon: true, }, args: { label: 'Hello World', primary: true,...
1,258
0
petrpan-code/storybookjs/storybook/code/lib/router
petrpan-code/storybookjs/storybook/code/lib/router/src/utils.test.ts
import { buildArgsParam, deepDiff, DEEPLY_EQUAL, getMatch, parsePath } from './utils'; jest.mock('@storybook/client-logger', () => ({ once: { warn: jest.fn() }, })); describe('getMatch', () => { it('gets startsWithTarget match', () => { const output = getMatch('/foo/bar', '/foo', true); expect(output).to...
1,290
0
petrpan-code/storybookjs/storybook/code/lib/telemetry
petrpan-code/storybookjs/storybook/code/lib/telemetry/src/anonymous-id.test.ts
import { normalizeGitUrl } from './anonymous-id'; describe('normalizeGitUrl', () => { it('trims off https://', () => { expect(normalizeGitUrl('https://github.com/storybookjs/storybook.git')).toEqual( 'github.com/storybookjs/storybook.git' ); }); it('trims off http://', () => { expect(normalize...
1,292
0
petrpan-code/storybookjs/storybook/code/lib/telemetry
petrpan-code/storybookjs/storybook/code/lib/telemetry/src/event-cache.test.ts
import { getPrecedingUpgrade } from './event-cache'; expect.addSnapshotSerializer({ print: (val: any) => JSON.stringify(val, null, 2), test: (val) => typeof val !== 'string', }); describe('event-cache', () => { const init = { body: { eventType: 'init', eventId: 'init' }, timestamp: 1 }; const upgrade = { body...
1,294
0
petrpan-code/storybookjs/storybook/code/lib/telemetry
petrpan-code/storybookjs/storybook/code/lib/telemetry/src/get-chromatic-version.test.ts
import { getChromaticVersionSpecifier } from './get-chromatic-version'; it('works for dependencies', () => { expect(getChromaticVersionSpecifier({ dependencies: { chromatic: '^6.11.4' } })).toBe('^6.11.4'); }); it('works for scripts', () => { expect(getChromaticVersionSpecifier({ scripts: { chromatic: 'npx chroma...
1,296
0
petrpan-code/storybookjs/storybook/code/lib/telemetry
petrpan-code/storybookjs/storybook/code/lib/telemetry/src/get-framework-info.test.ts
import type { StorybookConfig } from '@storybook/types'; import path from 'path'; import { getFrameworkInfo } from './get-framework-info'; import { getActualPackageJson } from './package-json'; jest.mock('./package-json', () => ({ getActualPackageJson: jest.fn(), })); describe('getFrameworkInfo', () => { it('shou...
1,298
0
petrpan-code/storybookjs/storybook/code/lib/telemetry
petrpan-code/storybookjs/storybook/code/lib/telemetry/src/get-monorepo-type.test.ts
/* eslint-disable no-underscore-dangle */ import path from 'path'; import { getMonorepoType, monorepoConfigs } from './get-monorepo-type'; // eslint-disable-next-line global-require, jest/no-mocks-import jest.mock('fs-extra', () => require('../../../__mocks__/fs-extra')); jest.mock('@storybook/core-common', () => { ...
1,304
0
petrpan-code/storybookjs/storybook/code/lib/telemetry
petrpan-code/storybookjs/storybook/code/lib/telemetry/src/sanitize.test.ts
/* eslint-disable local-rules/no-uncategorized-errors */ import { sanitizeError, cleanPaths } from './sanitize'; describe(`Errors Helpers`, () => { describe(`sanitizeError`, () => { it(`Sanitizes ansi codes in error`, () => { const errorMessage = `\u001B[4mStorybook\u001B[0m`; let e: any; try {...
1,306
0
petrpan-code/storybookjs/storybook/code/lib/telemetry
petrpan-code/storybookjs/storybook/code/lib/telemetry/src/session-id.test.ts
import { nanoid } from 'nanoid'; import { cache } from '@storybook/core-common'; import { resetSessionIdForTest, getSessionId, SESSION_TIMEOUT } from './session-id'; jest.mock('@storybook/core-common', () => { const actual = jest.requireActual('@storybook/core-common'); return { ...actual, cache: { g...
1,308
0
petrpan-code/storybookjs/storybook/code/lib/telemetry
petrpan-code/storybookjs/storybook/code/lib/telemetry/src/storybook-metadata.test.ts
import type { PackageJson, StorybookConfig } from '@storybook/types'; import path from 'path'; import { computeStorybookMetadata, metaFrameworks, sanitizeAddonName } from './storybook-metadata'; const packageJsonMock: PackageJson = { name: 'some-user-project', version: 'x.x.x', }; const mainJsMock: StorybookConf...
1,310
0
petrpan-code/storybookjs/storybook/code/lib/telemetry
petrpan-code/storybookjs/storybook/code/lib/telemetry/src/telemetry.test.ts
/// <reference types="@types/jest" />; import fetch from 'node-fetch'; import { sendTelemetry } from './telemetry'; jest.mock('node-fetch'); jest.mock('./event-cache', () => { return { set: jest.fn() }; }); jest.mock('./session-id', () => { return { getSessionId: async () => { return 'session-id'; ...
1,317
0
petrpan-code/storybookjs/storybook/code/lib
petrpan-code/storybookjs/storybook/code/lib/test/tsconfig.json
{ "extends": "../../tsconfig.json", "include": ["src/**/*"] }
1,398
0
petrpan-code/storybookjs/storybook/code/presets/react-webpack
petrpan-code/storybookjs/storybook/code/presets/react-webpack/src/cra-config.test.ts
import fs from 'fs'; import path from 'path'; import { getReactScriptsPath } from './cra-config'; jest.mock('fs', () => ({ realpathSync: jest.fn(() => '/test-project'), readFileSync: jest.fn(), existsSync: jest.fn(() => true), })); const SCRIPT_PATH = path.join('.bin', 'react-scripts'); describe('cra-config', ...
1,401
0
petrpan-code/storybookjs/storybook/code/presets/react-webpack
petrpan-code/storybookjs/storybook/code/presets/react-webpack/src/framework-preset-react-docs.test.ts
import ReactDocgenTypescriptPlugin from '@storybook/react-docgen-typescript-plugin'; import type { TypescriptOptions } from '@storybook/core-webpack'; import type { Configuration } from 'webpack'; import * as preset from './framework-preset-react-docs'; jest.mock('./requirer', () => ({ requirer: (resolver: any, path...
1,403
0
petrpan-code/storybookjs/storybook/code/presets/react-webpack
petrpan-code/storybookjs/storybook/code/presets/react-webpack/src/framework-preset-react.test.ts
import type { Configuration } from 'webpack'; import ReactRefreshWebpackPlugin from '@pmmmwh/react-refresh-webpack-plugin'; import type { Options } from '@storybook/core-webpack'; import * as preset from './framework-preset-react'; const mockApply = jest.fn(); jest.mock('@pmmmwh/react-refresh-webpack-plugin', () => { ...
1,421
0
petrpan-code/storybookjs/storybook/code/presets/server-webpack/src/lib
petrpan-code/storybookjs/storybook/code/presets/server-webpack/src/lib/compiler/json-to-csf-compiler.test.ts
import 'jest-specific-snapshot'; import path from 'path'; import fs from 'fs-extra'; import YAML from 'yaml'; import { compileCsfModule } from '.'; async function generate(filePath: string) { const content = await fs.readFile(filePath, 'utf8'); const parsed = filePath.endsWith('.json') ? JSON.parse(content) : YAML...
1,499
0
petrpan-code/storybookjs/storybook/code/renderers/html/src
petrpan-code/storybookjs/storybook/code/renderers/html/src/docs/sourceDecorator.test.ts
import { SNIPPET_RENDERED } from '@storybook/docs-tools'; import { addons, useEffect } from '@storybook/preview-api'; import { sourceDecorator } from './sourceDecorator'; import type { StoryContext } from '../types'; jest.mock('@storybook/preview-api'); const mockedAddons = addons as jest.Mocked<typeof addons>; const ...
1,568
0
petrpan-code/storybookjs/storybook/code/renderers/react
petrpan-code/storybookjs/storybook/code/renderers/react/src/public-api.test.ts
import * as api from '.'; describe('preview', () => { afterEach(() => { jest.resetModules(); }); const isFunction = (value: unknown) => typeof value === 'function'; it('should return the client api in a browser environment', () => { expect(Object.keys(api).length).toBeGreaterThan(0); expect(Objec...
1,570
0
petrpan-code/storybookjs/storybook/code/renderers/react
petrpan-code/storybookjs/storybook/code/renderers/react/src/public-types.test.tsx
import { describe, test } from '@jest/globals'; import { satisfies } from '@storybook/core-common'; import type { Args, StoryAnnotations, StrictArgs } from '@storybook/types'; import { expectTypeOf } from 'expect-type'; import type { KeyboardEventHandler, ReactNode } from 'react'; import React from 'react'; import ty...
1,580
0
petrpan-code/storybookjs/storybook/code/renderers/react/src
petrpan-code/storybookjs/storybook/code/renderers/react/src/__test__/composeStories.test.tsx
/// <reference types="@types/jest" />; import React from 'react'; import { render, screen } from '@testing-library/react'; import type { Meta } from '@storybook/react'; import { expectTypeOf } from 'expect-type'; import { setProjectAnnotations, composeStories, composeStory } from '..'; import type { Button } from './...
1,581
0
petrpan-code/storybookjs/storybook/code/renderers/react/src
petrpan-code/storybookjs/storybook/code/renderers/react/src/__test__/internals.test.tsx
/// <reference types="@types/jest" />; /* eslint-disable @typescript-eslint/no-non-null-assertion */ import React from 'react'; import { addons } from '@storybook/preview-api'; import { render, screen } from '@testing-library/react'; import { composeStories, composeStory } from '..'; import * as stories from './Butto...
1,582
0
petrpan-code/storybookjs/storybook/code/renderers/react/src/__test__
petrpan-code/storybookjs/storybook/code/renderers/react/src/__test__/__snapshots__/internals.test.tsx.snap
// Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Renders CSF2Secondary story 1`] = ` <body> <div> <button class="storybook-button storybook-button--medium storybook-button--secondary" type="button" > Children coming from story args! </button> </div> </body> `; exports[`Renders CSF...
1,584
0
petrpan-code/storybookjs/storybook/code/renderers/react/src
petrpan-code/storybookjs/storybook/code/renderers/react/src/docs/extractArgTypes.test.ts
import 'jest-specific-snapshot'; import path from 'path'; import fs from 'fs'; // @ts-expect-error (seems broken/missing) import requireFromString from 'require-from-string'; import { transformFileSync, transformSync } from '@babel/core'; import { inferControls } from '@storybook/preview-api'; import type { Renderer }...
1,587
0
petrpan-code/storybookjs/storybook/code/renderers/react/src
petrpan-code/storybookjs/storybook/code/renderers/react/src/docs/jsxDecorator.test.tsx
/* eslint-disable jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events */ import type { FC, PropsWithChildren } from 'react'; import React, { createElement, Profiler } from 'react'; import PropTypes from 'prop-types'; import { addons, useEffect } from '@storybook/preview-api'; import { SNIPPET...
1,600
0
petrpan-code/storybookjs/storybook/code/renderers/react/src/docs/lib
petrpan-code/storybookjs/storybook/code/renderers/react/src/docs/lib/inspection/acornParser.test.ts
import { parse } from './acornParser'; import type { InspectionElement, InspectionObject, InspectionArray, InspectionIdentifier, InspectionLiteral, InspectionFunction, InspectionUnknown, } from './types'; import { InspectionType } from './types'; describe('parse', () => { describe('expression', () => {...
1,606
0
petrpan-code/storybookjs/storybook/code/renderers/react/src/docs
petrpan-code/storybookjs/storybook/code/renderers/react/src/docs/propTypes/generateFuncSignature.test.ts
import { parseJsDoc } from '@storybook/docs-tools'; import { generateFuncSignature, generateShortFuncSignature } from './generateFuncSignature'; describe('generateFuncSignature', () => { it('should return an empty string when there is no @params and @returns tags', () => { // @ts-expect-error (invalid input) ...
1,608
0
petrpan-code/storybookjs/storybook/code/renderers/react/src/docs
petrpan-code/storybookjs/storybook/code/renderers/react/src/docs/propTypes/handleProp.test.tsx
/* eslint-disable no-underscore-dangle */ import PropTypes from 'prop-types'; import React from 'react'; import { type PropDef, extractComponentProps, type DocgenInfo, type DocgenPropDefaultValue, } from '@storybook/docs-tools'; import { enhancePropTypesProp, enhancePropTypesProps } from './handleProp'; type ...
1,612
0
petrpan-code/storybookjs/storybook/code/renderers/react/src/docs
petrpan-code/storybookjs/storybook/code/renderers/react/src/docs/typeScript/handleProp.test.tsx
/* eslint-disable no-underscore-dangle */ import React from 'react'; import { type PropDef, extractComponentProps, type DocgenInfo, type DocgenPropDefaultValue, } from '@storybook/docs-tools'; import { enhanceTypeScriptProp } from './handleProp'; type Component = any; const DOCGEN_SECTION = 'props'; functio...
1,818
0
petrpan-code/storybookjs/storybook/code/renderers/svelte
petrpan-code/storybookjs/storybook/code/renderers/svelte/src/public-types.test.ts
import { describe, test } from '@jest/globals'; import { satisfies } from '@storybook/core-common'; import type { ComponentAnnotations, StoryAnnotations } from '@storybook/types'; import { expectTypeOf } from 'expect-type'; import type { ComponentProps, SvelteComponentTyped } from 'svelte'; import Button from './__test...
1,826
0
petrpan-code/storybookjs/storybook/code/renderers/svelte/src
petrpan-code/storybookjs/storybook/code/renderers/svelte/src/docs/extractArgTypes.test.ts
import { describe, expect } from '@jest/globals'; import svelteDoc from 'sveltedoc-parser'; import * as fs from 'fs'; import { createArgTypes } from './extractArgTypes'; const content = fs.readFileSync(`${__dirname}/sample/MockButton.svelte`, 'utf-8'); describe('Extracting Arguments', () => { it('should be svelte', ...
1,828
0
petrpan-code/storybookjs/storybook/code/renderers/svelte/src
petrpan-code/storybookjs/storybook/code/renderers/svelte/src/docs/extractComponentDescription.test.ts
import { describe, expect, test } from '@jest/globals'; import { extractComponentDescription } from './extractComponentDescription'; describe('extractComponentDescription', () => { test('Extract from docgen', () => { expect(extractComponentDescription({ __docgen: { description: 'a description' } })).toBe( ...
1,830
0
petrpan-code/storybookjs/storybook/code/renderers/svelte/src
petrpan-code/storybookjs/storybook/code/renderers/svelte/src/docs/sourceDecorator.test.ts
import { describe, expect, test } from '@jest/globals'; import type { Args } from '@storybook/types'; import { generateSvelteSource } from './sourceDecorator'; expect.addSnapshotSerializer({ print: (val: any) => val, test: (val: unknown) => typeof val === 'string', }); const loremIpsum = 'Lorem ipsum dolor sit am...
1,882
0
petrpan-code/storybookjs/storybook/code/renderers/vue
petrpan-code/storybookjs/storybook/code/renderers/vue/src/public-types.test.ts
import { satisfies } from '@storybook/core-common'; import type { ComponentAnnotations, StoryAnnotations } from '@storybook/types'; import { expectTypeOf } from 'expect-type'; import type { SetOptional } from 'type-fest'; import type { Component } from 'vue'; import type { ExtendedVue } from 'vue/types/vue'; import { V...
1,890
0
petrpan-code/storybookjs/storybook/code/renderers/vue/src
petrpan-code/storybookjs/storybook/code/renderers/vue/src/docs/sourceDecorator.test.ts
/* eslint no-underscore-dangle: ["error", { "allow": ["_vnode"] }] */ import type { ComponentOptions, VueConstructor } from 'vue'; import Vue from 'vue/dist/vue'; import { vnodeToString } from './sourceDecorator'; expect.addSnapshotSerializer({ print: (val: any) => val, test: (val) => typeof val === 'string', });...
1,921
0
petrpan-code/storybookjs/storybook/code/renderers/vue3
petrpan-code/storybookjs/storybook/code/renderers/vue3/src/public-types.test.ts
import { satisfies } from '@storybook/core-common'; import type { ComponentAnnotations, StoryAnnotations } from '@storybook/types'; import { expectTypeOf } from 'expect-type'; import type { SetOptional } from 'type-fest'; import { h } from 'vue'; import type { ComponentPropsAndSlots, Decorator, Meta, StoryObj } from '....
1,923
0
petrpan-code/storybookjs/storybook/code/renderers/vue3
petrpan-code/storybookjs/storybook/code/renderers/vue3/src/render.test.ts
import { expectTypeOf } from 'expect-type'; import { reactive } from 'vue'; import { updateArgs } from './render'; describe('Render Story', () => { test('update reactive Args updateArgs()', () => { const reactiveArgs = reactive({ argFoo: 'foo', argBar: 'bar' }); // get reference to reactiveArgs or create a new ...
1,932
0
petrpan-code/storybookjs/storybook/code/renderers/vue3/src
petrpan-code/storybookjs/storybook/code/renderers/vue3/src/docs/sourceDecorator.test.ts
import { describe, expect, test } from '@jest/globals'; import { mapAttributesAndDirectives, generateAttributesSource, attributeSource, htmlEventAttributeToVueEventAttribute as htmlEventToVueEvent, } from './sourceDecorator'; expect.addSnapshotSerializer({ print: (val: any) => val, test: (val: unknown) =>...
1,997
0
petrpan-code/storybookjs/storybook/code/renderers/web-components/src
petrpan-code/storybookjs/storybook/code/renderers/web-components/src/docs/custom-elements.test.ts
/* eslint-disable no-underscore-dangle */ import { global } from '@storybook/global'; import { extractArgTypes } from './custom-elements'; import customElementsManifest from './__testfixtures__/custom-elements.json'; const { window } = global; describe('extractArgTypes', () => { beforeEach(() => { window.__STOR...
1,999
0
petrpan-code/storybookjs/storybook/code/renderers/web-components/src
petrpan-code/storybookjs/storybook/code/renderers/web-components/src/docs/sourceDecorator.test.ts
import { html, render } from 'lit'; import { styleMap } from 'lit/directives/style-map.js'; import { addons, useEffect } from '@storybook/preview-api'; import { SNIPPET_RENDERED } from '@storybook/docs-tools'; import type { StoryContext } from '../types'; import { sourceDecorator } from './sourceDecorator'; jest.mock(...
2,001
0
petrpan-code/storybookjs/storybook/code/renderers/web-components/src
petrpan-code/storybookjs/storybook/code/renderers/web-components/src/docs/web-components-properties.test.ts
import 'jest-specific-snapshot'; import path from 'path'; import fs from 'fs'; import tmp from 'tmp'; import { sync as spawnSync } from 'cross-spawn'; // File hierarchy: // __testfixtures__ / some-test-case / input.* const inputRegExp = /^input\..*$/; const runWebComponentsAnalyzer = (inputPath: string) => { const ...
2,068
0
petrpan-code/storybookjs/storybook/code/ui/blocks/src
petrpan-code/storybookjs/storybook/code/ui/blocks/src/blocks/DocsPage.test.ts
import { extractTitle } from './Title'; describe('defaultTitleSlot', () => { it('splits on last /', () => { expect(extractTitle('a/b/c')).toBe('c'); expect(extractTitle('a|b')).toBe('a|b'); expect(extractTitle('a/b/c.d')).toBe('c.d'); }); });
2,153
0
petrpan-code/storybookjs/storybook/code/ui/blocks/src
petrpan-code/storybookjs/storybook/code/ui/blocks/src/controls/Date.test.ts
import { parseDate, parseTime, formatDate, formatTime } from './Date'; describe('Date control', () => { it.each([ // name, input, expected ['same date', '2022-01-01', '2022-01-01'], ['month and day not padded with zeros', '2022-1-1', '2022-01-01'], ['different year', '1900-10-1', '1900-10-01'], ])(...
2,165
0
petrpan-code/storybookjs/storybook/code/ui/blocks/src
petrpan-code/storybookjs/storybook/code/ui/blocks/src/controls/helpers.test.ts
import { getControlId, getControlSetterButtonId } from './helpers'; describe('getControlId', () => { it.each([ // caseName, input, expected ['lower case', 'some-id', 'control-some-id'], ['upper case', 'SOME-ID', 'control-SOME-ID'], ['all valid characters', 'some_weird-:custom.id', 'control-some_weird...
2,253
0
petrpan-code/storybookjs/storybook/code/ui/components/src/components
petrpan-code/storybookjs/storybook/code/ui/components/src/components/syntaxhighlighter/formatter.test.ts
import { dedent } from 'ts-dedent'; import { formatter } from './formatter'; describe('dedent', () => { test('handles empty string', () => { const input = ''; const result = formatter(true, input); expect(result).toBe(input); }); test('handles single line', () => { const input = 'console.log("...
2,307
0
petrpan-code/storybookjs/storybook/code/ui/components/src/components/typography
petrpan-code/storybookjs/storybook/code/ui/components/src/components/typography/link/link.test.tsx
import type { AnchorHTMLAttributes } from 'react'; import React from 'react'; import { render, screen } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import { ThemeProvider, themes, convert } from '@storybook/theming'; import type { LinkProps } from './link'; import { Link } from '...
2,327
0
petrpan-code/storybookjs/storybook/code/ui/manager/src
petrpan-code/storybookjs/storybook/code/ui/manager/src/__tests__/index.test.ts
import { renderStorybookUI } from '..'; describe('Main API', () => { it('should fail if provider is not extended from the base Provider', () => { const run = () => { const fakeProvider = {}; // @ts-expect-error (Converted from ts-ignore) renderStorybookUI(null, fakeProvider); }; expect...
2,390
0
petrpan-code/storybookjs/storybook/code/ui/manager/src/components/sidebar
petrpan-code/storybookjs/storybook/code/ui/manager/src/components/sidebar/__tests__/Sidebar.test.tsx
import React from 'react'; import { render, screen, fireEvent } from '@testing-library/react'; import { ThemeProvider, ensure, themes } from '@storybook/theming'; import type { HashEntry, Refs } from '@storybook/manager-api'; import type { Theme } from '@storybook/theming'; import type { RenderResult } from '@testing-...
2,415
0
petrpan-code/storybookjs/storybook/code/ui/manager/src
petrpan-code/storybookjs/storybook/code/ui/manager/src/utils/status.test.ts
import { getHighestStatus, getGroupStatus } from './status'; import { mockDataset } from '../components/sidebar/mockdata'; describe('getHighestStatus', () => { test('default value', () => { expect(getHighestStatus([])).toBe('unknown'); }); test('should return the highest status', () => { expect(getHighes...
3,679
0
petrpan-code/storybookjs/storybook/docs/snippets
petrpan-code/storybookjs/storybook/docs/snippets/react/multiple-stories-test.ts.mdx
```ts // Form.test.ts|tsx import { fireEvent, render, screen } from '@testing-library/react'; import { composeStories } from '@storybook/react'; import * as FormStories from './LoginForm.stories'; const { InvalidForm, ValidForm } = composeStories(FormStories); test('Tests invalid form state', () => { render(<Inv...
3,708
0
petrpan-code/storybookjs/storybook/docs/snippets
petrpan-code/storybookjs/storybook/docs/snippets/react/reuse-args-test.ts.mdx
```ts // Button.test.ts|tsx import { render, screen } from '@testing-library/react'; import { composeStories } from '@storybook/react'; import * as stories from './Button.stories'; const { Primary } = composeStories(stories); test('reuses args from composed story', () => { render(<Primary />); const buttonEle...
3,712
0
petrpan-code/storybookjs/storybook/docs/snippets
petrpan-code/storybookjs/storybook/docs/snippets/react/single-story-test.ts.mdx
```ts // Form.test.ts|tsx import { fireEvent, render, screen } from '@testing-library/react'; import { composeStory } from '@storybook/react'; import Meta, { ValidForm as ValidFormStory } from './LoginForm.stories'; const FormOK = composeStory(ValidFormStory, Meta); test('Validates form', () => { render(<FormOK ...
4,559
0
petrpan-code/storybookjs/storybook/scripts/release
petrpan-code/storybookjs/storybook/scripts/release/__tests__/cancel-preparation-runs.test.ts
/* eslint-disable global-require */ /* eslint-disable no-underscore-dangle */ import { PREPARE_NON_PATCH_WORKFLOW_PATH, PREPARE_PATCH_WORKFLOW_PATH, run as cancelPreparationWorkflows, } from '../cancel-preparation-runs'; import * as github_ from '../utils/github-client'; jest.mock('../utils/github-client'); con...
4,560
0
petrpan-code/storybookjs/storybook/scripts/release
petrpan-code/storybookjs/storybook/scripts/release/__tests__/ensure-next-ahead.test.ts
/* eslint-disable global-require */ /* eslint-disable no-underscore-dangle */ import path from 'path'; import { run as ensureNextAhead } from '../ensure-next-ahead'; import * as gitClient_ from '../utils/git-client'; import * as bumpVersion_ from '../version'; jest.mock('../utils/git-client', () => jest.requireActual(...
4,561
0
petrpan-code/storybookjs/storybook/scripts/release
petrpan-code/storybookjs/storybook/scripts/release/__tests__/generate-pr-description.test.ts
import { generateReleaseDescription, generateNonReleaseDescription, mapToChangelist, mapCherryPicksToTodo, } from '../generate-pr-description'; import type { Change } from '../utils/get-changes'; describe('Generate PR Description', () => { const changes: Change[] = [ { user: 'JReinhold', id: ...
4,562
0
petrpan-code/storybookjs/storybook/scripts/release
petrpan-code/storybookjs/storybook/scripts/release/__tests__/is-pr-frozen.test.ts
/* eslint-disable no-underscore-dangle */ /* eslint-disable global-require */ import path from 'path'; import { run as isPrFrozen } from '../is-pr-frozen'; // eslint-disable-next-line jest/no-mocks-import jest.mock('fs-extra', () => require('../../../code/__mocks__/fs-extra')); jest.mock('../utils/get-github-info'); ...
4,563
0
petrpan-code/storybookjs/storybook/scripts/release
petrpan-code/storybookjs/storybook/scripts/release/__tests__/label-patches.test.ts
import type { LogResult } from 'simple-git'; import ansiRegex from 'ansi-regex'; import { run } from '../label-patches'; import * as gitClient_ from '../utils/git-client'; import * as githubInfo_ from '../utils/get-github-info'; import * as github_ from '../utils/github-client'; jest.mock('uuid'); jest.mock('../utils/...
4,564
0
petrpan-code/storybookjs/storybook/scripts/release
petrpan-code/storybookjs/storybook/scripts/release/__tests__/version.test.ts
/* eslint-disable global-require */ /* eslint-disable no-underscore-dangle */ import path from 'path'; import { run as version } from '../version'; // eslint-disable-next-line jest/no-mocks-import jest.mock('fs-extra', () => require('../../../code/__mocks__/fs-extra')); const fsExtra = require('fs-extra'); jest.mock(...
4,565
0
petrpan-code/storybookjs/storybook/scripts/release
petrpan-code/storybookjs/storybook/scripts/release/__tests__/write-changelog.test.ts
/* eslint-disable global-require */ /* eslint-disable no-underscore-dangle */ import path from 'path'; import dedent from 'ts-dedent'; import { run as writeChangelog } from '../write-changelog'; import * as changesUtils from '../utils/get-changes'; // eslint-disable-next-line jest/no-mocks-import jest.mock('fs-extra',...
4,595
0
petrpan-code/storybookjs/storybook/scripts
petrpan-code/storybookjs/storybook/scripts/tasks/smoke-test.ts
import type { Task } from '../task'; import { exec } from '../utils/exec'; export const smokeTest: Task = { description: 'Run the smoke tests of a sandbox', dependsOn: ['sandbox'], async ready() { return false; }, async run({ sandboxDir }, { dryRun, debug }) { // eslint-disable-next-line no-console ...
4,611
0
petrpan-code/storybookjs/storybook/scripts
petrpan-code/storybookjs/storybook/scripts/utils/options.test.ts
import { describe, expect, it } from '@jest/globals'; import { createCommand } from 'commander'; import { areOptionsSatisfied, createOptions, getCommand, getOptions } from './options'; const allOptions = createOptions({ first: { type: 'boolean', description: 'first', }, second: { type: 'boolean', ...
5,021
0
petrpan-code/apache/superset/superset-embedded-sdk
petrpan-code/apache/superset/superset-embedded-sdk/src/guestTokenRefresh.test.ts
/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you...
5,049
0
petrpan-code/apache/superset/superset-frontend/cypress-base/cypress/e2e
petrpan-code/apache/superset/superset-frontend/cypress-base/cypress/e2e/alerts_and_reports/alerts.test.ts
/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you...
5,050
0
petrpan-code/apache/superset/superset-frontend/cypress-base/cypress/e2e
petrpan-code/apache/superset/superset-frontend/cypress-base/cypress/e2e/alerts_and_reports/reports.test.ts
/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you...
5,051
0
petrpan-code/apache/superset/superset-frontend/cypress-base/cypress/e2e
petrpan-code/apache/superset/superset-frontend/cypress-base/cypress/e2e/chart_list/chartlist.applitools.test.ts
/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you...
5,052
0
petrpan-code/apache/superset/superset-frontend/cypress-base/cypress/e2e
petrpan-code/apache/superset/superset-frontend/cypress-base/cypress/e2e/chart_list/filter.test.ts
/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you...
5,053
0
petrpan-code/apache/superset/superset-frontend/cypress-base/cypress/e2e
petrpan-code/apache/superset/superset-frontend/cypress-base/cypress/e2e/chart_list/list.test.ts
/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you...
5,054
0
petrpan-code/apache/superset/superset-frontend/cypress-base/cypress/e2e
petrpan-code/apache/superset/superset-frontend/cypress-base/cypress/e2e/dashboard/_skip.controls.test.ts
/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you...
5,055
0
petrpan-code/apache/superset/superset-frontend/cypress-base/cypress/e2e
petrpan-code/apache/superset/superset-frontend/cypress-base/cypress/e2e/dashboard/_skip.filter.test.ts
/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you...
5,056
0
petrpan-code/apache/superset/superset-frontend/cypress-base/cypress/e2e
petrpan-code/apache/superset/superset-frontend/cypress-base/cypress/e2e/dashboard/_skip.key_value.test.ts
/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you...
5,057
0
petrpan-code/apache/superset/superset-frontend/cypress-base/cypress/e2e
petrpan-code/apache/superset/superset-frontend/cypress-base/cypress/e2e/dashboard/_skip.url_params.test.ts
/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you...
5,059
0
petrpan-code/apache/superset/superset-frontend/cypress-base/cypress/e2e
petrpan-code/apache/superset/superset-frontend/cypress-base/cypress/e2e/dashboard/dashboard.applitools.test.ts
/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you...
5,060
0
petrpan-code/apache/superset/superset-frontend/cypress-base/cypress/e2e
petrpan-code/apache/superset/superset-frontend/cypress-base/cypress/e2e/dashboard/drillby.test.ts
/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you...
5,061
0
petrpan-code/apache/superset/superset-frontend/cypress-base/cypress/e2e
petrpan-code/apache/superset/superset-frontend/cypress-base/cypress/e2e/dashboard/drilltodetail.test.ts
/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you...
5,062
0
petrpan-code/apache/superset/superset-frontend/cypress-base/cypress/e2e
petrpan-code/apache/superset/superset-frontend/cypress-base/cypress/e2e/dashboard/editmode.test.ts
/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you...
5,063
0
petrpan-code/apache/superset/superset-frontend/cypress-base/cypress/e2e
petrpan-code/apache/superset/superset-frontend/cypress-base/cypress/e2e/dashboard/load.test.ts
/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you...