level_0 int64 0 10k | index int64 0 0 | repo_id stringlengths 22 152 | file_path stringlengths 41 203 | content stringlengths 11 11.5M |
|---|---|---|---|---|
9,691 | 0 | petrpan-code/web-infra-dev/modern.js/packages/solutions/module-tools | petrpan-code/web-infra-dev/modern.js/packages/solutions/module-tools/tests/index.test.ts | import { moduleTools, defineConfig, legacyPresets } from '../src';
describe('index', () => {
it('defineConfig', () => {
expect(defineConfig({})).toBeDefined();
});
it('Plugin', () => {
expect(moduleTools()).toBeDefined();
});
it('legacyPresets', () => {
expect(legacyPresets).toBeDefined();
})... |
9,692 | 0 | petrpan-code/web-infra-dev/modern.js/packages/solutions/module-tools | petrpan-code/web-infra-dev/modern.js/packages/solutions/module-tools/tests/mapValue.test.ts | import { mapValue } from '../src/utils';
describe('mapValue', () => {
it('should work when `args[0]` is object', () => {
expect(mapValue({ a: 1, b: 2 }, x => x * x)).toEqual({ a: 1, b: 4 });
});
it('should work when `args[0]` is array', () => {
expect(mapValue(['a', 'b', 'c'], x => x)).toEqual({
'... |
9,693 | 0 | petrpan-code/web-infra-dev/modern.js/packages/solutions/module-tools | petrpan-code/web-infra-dev/modern.js/packages/solutions/module-tools/tests/merge-config.test.ts | import { mergeConfig } from '../src/config/normalize';
import { DTSOptions, PartialBaseBuildConfig } from '../src/types';
const defaultConfig: PartialBaseBuildConfig[] = [
{
format: 'esm',
dts: { distPath: './types' },
},
];
describe('mergeConfig', () => {
it('config is array', () => {
const config ... |
9,694 | 0 | petrpan-code/web-infra-dev/modern.js/packages/solutions/module-tools | petrpan-code/web-infra-dev/modern.js/packages/solutions/module-tools/tests/plugins.test.ts | import { getPlugins } from '../src/plugins';
describe('plugin.ts', () => {
it('getPlugins', () => {
expect(getPlugins('lint')[0].name).toBe('@modern-js/plugin-lint');
expect(getPlugins('change')[0].name).toBe('@modern-js/plugin-changeset');
expect(getPlugins('release')[0].name).toBe('@modern-js/plugin-ch... |
9,695 | 0 | petrpan-code/web-infra-dev/modern.js/packages/solutions/module-tools | petrpan-code/web-infra-dev/modern.js/packages/solutions/module-tools/tests/preset2config.test.ts | import { presetToConfig } from '../src/config/normalize';
import { BuildPreset } from '../src/types';
describe('presetToConfig', () => {
it('extendPreset', async () => {
const extendPreset: BuildPreset = function ({ extendPreset }) {
return extendPreset('npm-library', {
define: {
VERSION:... |
9,699 | 0 | petrpan-code/web-infra-dev/modern.js/packages/solutions/module-tools/tests | petrpan-code/web-infra-dev/modern.js/packages/solutions/module-tools/tests/style/rebaseUrl.test.ts | import path from 'path';
import { rebaseUrls } from '../../src/builder/feature/style/utils';
describe('rebase', () => {
it('rebaseUrl', async () => {
const rootFile = path.resolve(__dirname, 'index.less');
const file = path.resolve(__dirname, 'less/common.less');
const result = await rebaseUrls(
fi... |
9,763 | 0 | petrpan-code/web-infra-dev/modern.js/packages/solutions/monorepo-tools | petrpan-code/web-infra-dev/modern.js/packages/solutions/monorepo-tools/tests/getProjects.test.ts | import path from 'path';
import {
getProjectsByWorkspaceFile,
syncGetProjectsByWorkspaceFile,
} from '../src/projects/getProjectsByWorkspaceFile';
const root = path.join(__dirname, './fixtures/mono-1');
// globby needs setImmediate
// @ts-expect-error
global.setImmediate = setTimeout;
// @ts-expect-error
global... |
9,764 | 0 | petrpan-code/web-infra-dev/modern.js/packages/solutions/monorepo-tools | petrpan-code/web-infra-dev/modern.js/packages/solutions/monorepo-tools/tests/index.test.ts | import plugin from '../src';
describe('monorepo-tools', () => {
it('default', () => {
expect(plugin).toBeDefined();
});
});
|
9,824 | 0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/compiler/babel | petrpan-code/web-infra-dev/modern.js/packages/toolkit/compiler/babel/tests/build.test.ts | import * as path from 'path';
import { fs, glob, logger } from '@modern-js/utils';
import { build } from '../src/build';
const projectDir = path.join(__dirname, './fixtures/build');
const srcDir = path.join(projectDir, 'src');
const distDir = path.join(projectDir, 'dist');
const originalLogInfo = logger.info;
const o... |
9,825 | 0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/compiler/babel | petrpan-code/web-infra-dev/modern.js/packages/toolkit/compiler/babel/tests/buildWatch.test.ts | import * as path from 'path';
import { fs, logger } from '@modern-js/utils';
import {
buildWatch,
BuildWatchEmitter,
runBuildWatch,
BuildWatchEvent,
} from '../src/buildWatch';
import { ICompilerResult } from '../src/type';
const projectDir = path.join(__dirname, './fixtures/buildWatch');
const srcDir = path.j... |
9,826 | 0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/compiler/babel | petrpan-code/web-infra-dev/modern.js/packages/toolkit/compiler/babel/tests/compiler.test.ts | import * as path from 'path';
import { fs } from '@modern-js/utils';
import * as babel from '@babel/core';
import {
isRes,
getDistFilePath,
resolveSourceMap,
compiler,
} from '../src/compiler';
import { defaultDistFileExtMap } from '../src/constants';
describe('compiler', () => {
it('isRes', () => {
cons... |
9,827 | 0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/compiler/babel | petrpan-code/web-infra-dev/modern.js/packages/toolkit/compiler/babel/tests/compilerErrorResult.test.ts | import { CompilerErrorResult } from '../src/compilerErrorResult';
describe('CompilerErrorResult Class', () => {
it('call constructor without params', () => {
const cer_1 = new CompilerErrorResult();
expect(Array.isArray(cer_1._messageDetails)).toBe(true);
expect(cer_1._messageDetails.length).toBe(0);
}... |
9,828 | 0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/compiler/babel | petrpan-code/web-infra-dev/modern.js/packages/toolkit/compiler/babel/tests/constants.test.ts | import { defaultDistFileExtMap } from '../src/constants';
describe('constants', () => {
it('defaultDistFileExtMap', () => {
expect(defaultDistFileExtMap).toStrictEqual({
'.js': '.js',
'.jsx': '.js',
'.ts': '.js',
'.tsx': '.js',
});
});
});
|
9,829 | 0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/compiler/babel | petrpan-code/web-infra-dev/modern.js/packages/toolkit/compiler/babel/tests/defaults.test.ts | import { mergeDefaultOption } from '../src/defaults';
describe('defaults', () => {
it('should merge default option', () => {
const option_1 = mergeDefaultOption({
rootDir: './',
distDir: './dist',
filenames: ['far.js'],
});
expect(option_1).toStrictEqual({
rootDir: './',
dis... |
9,830 | 0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/compiler/babel | petrpan-code/web-infra-dev/modern.js/packages/toolkit/compiler/babel/tests/getFinalOption.test.ts | import * as path from 'path';
import { DEFAULT_EXTENSIONS } from '@babel/core';
import {
getFinalCompilerOption,
getFilesFromDir,
getFinalExtensions,
getGlobPattern,
} from '../src/getFinalOption';
import { defaultDistFileExtMap } from '../src/constants';
const projectDir = path.join(__dirname, './fixtures/get... |
9,831 | 0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/compiler/babel | petrpan-code/web-infra-dev/modern.js/packages/toolkit/compiler/babel/tests/index.test.ts | import * as path from 'path';
import { logger } from '@modern-js/utils';
import { compiler } from '../src';
import {
sourceDirAndFileNamesValidMessage,
watchDirValidMessage,
} from '../src/validate';
const projectDir = path.join(__dirname, './fixtures/lib');
const srcDir = path.join(projectDir, 'src');
const distD... |
9,833 | 0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/compiler/babel | petrpan-code/web-infra-dev/modern.js/packages/toolkit/compiler/babel/tests/utils.test.ts | // import * as path from 'path';
// import { fs } from '@modern-js/utils';
// import { addSourceMappingUrl } from '../src/utils';
describe('utils test', () => {
it('addSourceMappingUrl should right', () => {
// const code = 'const far = 1;';
// const mapLoc = `far.js.map`;
// const codeWithSourceMappingU... |
9,834 | 0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/compiler/babel | petrpan-code/web-infra-dev/modern.js/packages/toolkit/compiler/babel/tests/validate.test.ts | import {
validate,
validateWatchDir,
validateSourceDirAndFileNames,
sourceDirAndFileNamesValidMessage,
watchDirValidMessage,
} from '../src/validate';
describe('valide', () => {
const baseOption = { rootDir: './', distDir: './dist', quiet: true };
it('valide sourceDir and filenams config', () => {
c... |
9,879 | 0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/e2e/tests | petrpan-code/web-infra-dev/modern.js/packages/toolkit/e2e/tests/server/index.test.ts | import { readFileSync } from 'fs';
import got from 'got';
import { describe, expect, it } from 'vitest';
import { runStaticServer } from '../../src/server';
describe('runStaticServer', () => {
it('should run static server', async () => {
const { hostname, port } = await runStaticServer(__dirname);
expect(por... |
9,894 | 0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/node-bundle-require | petrpan-code/web-infra-dev/modern.js/packages/toolkit/node-bundle-require/tests/index.test.ts | import path, { dirname } from 'path';
import { fs } from '@modern-js/utils';
import { bundleRequire } from '../src';
import { EXTERNAL_REGEXP } from '../src/bundle';
describe('bundleRequire', () => {
const symlinkPackages = [
'test-package-ts',
'test-package-esm',
'test-package-esm-with-cjs',
];
bef... |
9,935 | 0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/plugin | petrpan-code/web-infra-dev/modern.js/packages/toolkit/plugin/tests/async.test.ts | /* eslint-disable max-lines */
import {
createPipeline,
createAsyncPipeline,
createContext,
} from '../src/farrow-pipeline';
import type { PluginOptions, AsyncSetup } from '../src';
import { createManager, createAsyncManager } from '../src/manager';
import { createWaterfall, createAsyncWaterfall } from '../src/wa... |
9,937 | 0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/plugin | petrpan-code/web-infra-dev/modern.js/packages/toolkit/plugin/tests/pipeline.test.ts | /* eslint-disable max-lines */
import {
createContext,
createPipeline,
createAsyncPipeline,
isPipeline,
} from '../src';
import { sleep } from './helpers';
describe('createPipeline', () => {
it('basic usage', async () => {
type Input = {
count: number;
};
type Output = PromiseLike<number> |... |
9,938 | 0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/plugin | petrpan-code/web-infra-dev/modern.js/packages/toolkit/plugin/tests/sync.test.ts | /* eslint-disable max-lines */
import {
createPipeline,
createAsyncPipeline,
createContext,
} from '../src/farrow-pipeline';
import type { PluginOptions, Setup } from '../src';
import { createManager, createAsyncManager } from '../src/manager';
import { createWaterfall, createAsyncWaterfall } from '../src/waterfa... |
9,940 | 0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/plugin | petrpan-code/web-infra-dev/modern.js/packages/toolkit/plugin/tests/waterfall.test.ts | import {
createWaterfall,
createAsyncWaterfall,
createContext,
isWaterfall,
isAsyncWaterfall,
} from '../src';
import { sleep } from './helpers';
describe('waterfall', () => {
it('base usage', () => {
const waterfall = createWaterfall<{ count: number }>();
waterfall.use(({ count }) => ({ count: co... |
9,941 | 0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/plugin | petrpan-code/web-infra-dev/modern.js/packages/toolkit/plugin/tests/workflow.test.ts | import {
createWorkflow,
createAsyncWorkflow,
createParallelWorkflow,
isWorkflow,
isAsyncWorkflow,
isParallelWorkflow,
} from '../src/workflow';
import { sleep } from './helpers';
describe('workflow', () => {
describe('sync', () => {
it('should run with attaching order', () => {
const workflow ... |
9,979 | 0 | petrpan-code/web-infra-dev/modern.js/packages/toolkit/runtime-utils/tests | petrpan-code/web-infra-dev/modern.js/packages/toolkit/runtime-utils/tests/brower/parse.test.ts | import { parsedJSONFromElement } from '../../src/browser';
describe('parsed utils', () => {
it('should return null if no alias config', () => {
document.body.innerHTML = `<script id='test' type="appliction/json">{"name": "modern.js"}</script>`;
expect(parsedJSONFromElement('test')).toEqual({ name: 'modern.j... |
390 | 0 | petrpan-code/mui/material-ui/packages/mui-material/src | petrpan-code/mui/material-ui/packages/mui-material/src/Stepper/Stepper.test.tsx | import * as React from 'react';
import { expect } from 'chai';
import { createRenderer, describeConformance } from '@mui-internal/test-utils';
import Step, { StepProps, stepClasses } from '@mui/material/Step';
import StepLabel from '@mui/material/StepLabel';
import StepConnector, { stepConnectorClasses } from '@mui/mat... |
640 | 0 | petrpan-code/mui/material-ui/packages/mui-material/src | petrpan-code/mui/material-ui/packages/mui-material/src/styles/ThemeProvider.test.tsx | import * as React from 'react';
import { expect } from 'chai';
import { createRenderer } from '@mui-internal/test-utils';
import { ThemeProvider } from '@mui/material/styles';
describe('ThemeProvider', () => {
const { render } = createRenderer();
it('When theme is a function, it should not show warning', () => {
... |
671 | 0 | petrpan-code/mui/material-ui/packages/mui-material/src | petrpan-code/mui/material-ui/packages/mui-material/src/styles/excludeVariablesFromRoot.test.ts | import { expect } from 'chai';
import excludeVariablesFromRoot from './excludeVariablesFromRoot';
describe('excludeVariablesFromRoot', () => {
it('should return true', () => {
expect(excludeVariablesFromRoot('mui').includes(`--mui-overlays-1`)).to.equal(true);
expect(excludeVariablesFromRoot('mui').includes(... |
973 | 0 | petrpan-code/mui/material-ui/packages/mui-styles | petrpan-code/mui/material-ui/packages/mui-styles/test/theme-scoping.test.tsx | import * as React from 'react';
import { expect } from 'chai';
import { createRenderer } from '@mui-internal/test-utils';
import * as material from '@mui/material/styles';
import * as joy from '@mui/joy/styles';
import { makeStyles } from '@mui/styles';
describe('Theme scoping', () => {
const { render } = createRend... |
1,049 | 0 | petrpan-code/mui/material-ui/packages/mui-system/src | petrpan-code/mui/material-ui/packages/mui-system/src/GlobalStyles/GlobalStyles.test.tsx | import * as React from 'react';
import { expect } from 'chai';
import { createRenderer } from '@mui-internal/test-utils';
import { GlobalStyles } from '@mui/system';
describe('<GlobalStyles />', () => {
const { render } = createRenderer();
it('should work', () => {
expect(() => render(<GlobalStyles styles={{}... |
1,071 | 0 | petrpan-code/mui/material-ui/packages/mui-system/src | petrpan-code/mui/material-ui/packages/mui-system/src/Unstable_Grid/traverseBreakpoints.test.ts | import { expect } from 'chai';
import createBreakpoints from '../createTheme/createBreakpoints';
import { traverseBreakpoints, filterBreakpointKeys } from './traverseBreakpoints';
const breakpoints = createBreakpoints({});
describe('traverse breakpoints', () => {
it('supports array', () => {
const styles = {};
... |
1,076 | 0 | petrpan-code/mui/material-ui/packages/mui-system/src | petrpan-code/mui/material-ui/packages/mui-system/src/createTheme/createSpacing.test.ts | import { expect } from 'chai';
import createSpacing, { Spacing } from './createSpacing';
describe('createSpacing', () => {
it('should be configurable', () => {
let spacing: Spacing;
spacing = createSpacing();
expect(spacing(1)).to.equal('8px');
spacing = createSpacing(10);
expect(spacing(1)).to.e... |
1,090 | 0 | petrpan-code/mui/material-ui/packages/mui-system/src | petrpan-code/mui/material-ui/packages/mui-system/src/cssVars/createGetCssVar.test.ts | import { expect } from 'chai';
import createGetCssVar from './createGetCssVar';
describe('createGetCssVar', () => {
describe('default without prefix', () => {
const getThemeVar = createGetCssVar();
it('should return correct CSS var with default prefix', () => {
expect(getThemeVar('palette-primary-500')... |
1,092 | 0 | petrpan-code/mui/material-ui/packages/mui-system/src | petrpan-code/mui/material-ui/packages/mui-system/src/cssVars/cssVarsParser.test.ts | import { expect } from 'chai';
import cssVarsParser, { assignNestedKeys, walkObjectDeep } from './cssVarsParser';
describe('cssVarsParser', () => {
describe('assignNestedKeys', () => {
it('does not account for null, undefined, non-object', () => {
let result;
assignNestedKeys(result, ['a', 'b', 'c'],... |
1,097 | 0 | petrpan-code/mui/material-ui/packages/mui-system/src | petrpan-code/mui/material-ui/packages/mui-system/src/cssVars/prepareCssVars.test.ts | import { expect } from 'chai';
import prepareCssVars from './prepareCssVars';
describe('prepareCssVars', () => {
it('`generateCssVars` should always return a new object', () => {
const result = prepareCssVars({
colorSchemes: {
dark: {
color: 'red',
},
},
});
const {... |
1,123 | 0 | petrpan-code/mui/material-ui/packages/mui-system/test | petrpan-code/mui/material-ui/packages/mui-system/test/integration/theme-scoping.test.tsx | import * as React from 'react';
import { expect } from 'chai';
import { spy } from 'sinon';
import { createRenderer } from '@mui-internal/test-utils';
import { ThemeContext } from '@mui/styled-engine';
import * as material from '@mui/material';
import * as joy from '@mui/joy';
import * as md3 from '@mui/material-next';... |
1,158 | 0 | petrpan-code/mui/material-ui/packages/mui-utils | petrpan-code/mui/material-ui/packages/mui-utils/src/deepmerge.test.ts | import { expect } from 'chai';
import deepmerge from './deepmerge';
describe('deepmerge', () => {
// https://snyk.io/blog/after-three-years-of-silence-a-new-jquery-prototype-pollution-vulnerability-emerges-once-again/
it('should not be subject to prototype pollution', () => {
deepmerge({}, JSON.parse('{ "myPro... |
1,163 | 0 | petrpan-code/mui/material-ui/packages/mui-utils | petrpan-code/mui/material-ui/packages/mui-utils/src/elementAcceptingRef.test.tsx | /* eslint-disable react/prefer-stateless-function */
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import { expect } from 'chai';
import PropTypes from 'prop-types';
import elementAcceptingRef from './elementAcceptingRef';
describe('elementAcceptingRef', () => {
function checkPropType(elemen... |
1,165 | 0 | petrpan-code/mui/material-ui/packages/mui-utils | petrpan-code/mui/material-ui/packages/mui-utils/src/elementTypeAcceptingRef.test.tsx | /* eslint-disable react/prefer-stateless-function */
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import { expect } from 'chai';
import PropTypes from 'prop-types';
import elementTypeAcceptingRef from './elementTypeAcceptingRef';
describe('elementTypeAcceptingRef', () => {
function checkPro... |
1,168 | 0 | petrpan-code/mui/material-ui/packages/mui-utils | petrpan-code/mui/material-ui/packages/mui-utils/src/getDisplayName.test.tsx | /* eslint-disable react/prefer-stateless-function */
import * as React from 'react';
import { expect } from 'chai';
import getDisplayName, { getFunctionName } from './getDisplayName';
describe('utils/getDisplayName.js', () => {
describe('getDisplayName', () => {
it('gets the display name of a React component', (... |
1,170 | 0 | petrpan-code/mui/material-ui/packages/mui-utils | petrpan-code/mui/material-ui/packages/mui-utils/src/getScrollbarSize.test.ts | import { expect } from 'chai';
import getScrollbarSize from './getScrollbarSize';
describe('getScrollbarSize', () => {
let styleElement: HTMLElement;
let divElement: HTMLElement;
beforeEach(() => {
styleElement = document.createElement('style');
divElement = document.createElement('div');
});
after... |
1,182 | 0 | petrpan-code/mui/material-ui/packages/mui-utils | petrpan-code/mui/material-ui/packages/mui-utils/src/resolveProps.test.ts | import { expect } from 'chai';
import resolveProps from './resolveProps';
describe('resolveProps', () => {
it('use default props if no props', () => {
expect(resolveProps({ foo: 'foo' }, {})).to.deep.equal({
foo: 'foo',
});
});
it('use props if defined', () => {
expect(resolveProps({ foo: 'foo... |
1,187 | 0 | petrpan-code/mui/material-ui/packages/mui-utils | petrpan-code/mui/material-ui/packages/mui-utils/src/setRef.test.ts | import * as React from 'react';
import { expect } from 'chai';
import { spy } from 'sinon';
import setRef from './setRef';
describe('setRef', () => {
it('can handle callback refs', () => {
const ref = spy();
const instance = 'proxy';
setRef(ref, instance);
expect(ref.called).to.equal(true);
exp... |
1,204 | 0 | petrpan-code/mui/material-ui/packages/mui-utils/src | petrpan-code/mui/material-ui/packages/mui-utils/src/chainPropTypes/chainPropTypes.test.ts | import { expect } from 'chai';
import PropTypes from 'prop-types';
import chainPropTypes from './chainPropTypes';
describe('chainPropTypes', () => {
const props = {};
const propName = 'children';
const componentName = 'ComponentName';
const location = 'prop';
beforeEach(() => {
PropTypes.resetWarningCac... |
1,207 | 0 | petrpan-code/mui/material-ui/packages/mui-utils/src | petrpan-code/mui/material-ui/packages/mui-utils/src/composeClasses/composeClasses.test.ts | import { expect } from 'chai';
import { unstable_composeClasses as composeClasses } from '@mui/utils';
describe('composeClasses', () => {
it('should generate the classes based on the slots', () => {
expect(
composeClasses(
{
root: ['root', 'standard'],
slot: ['slot'],
},... |
1,213 | 0 | petrpan-code/mui/material-ui/packages/mui-utils/src | petrpan-code/mui/material-ui/packages/mui-utils/src/exactProp/exactProp.test.ts | import { expect } from 'chai';
import PropTypes from 'prop-types';
import exactProp from './exactProp';
describe('exactProp()', () => {
beforeEach(() => {
PropTypes.resetWarningCache();
});
it('should return null for supported props', () => {
const props = {
bar: false,
};
const propTypes ... |
1,216 | 0 | petrpan-code/mui/material-ui/packages/mui-utils/src | petrpan-code/mui/material-ui/packages/mui-utils/src/generateUtilityClass/generateUtilityClass.test.ts | import { expect } from 'chai';
import {
unstable_generateUtilityClass as generateUtilityClass,
unstable_ClassNameGenerator as ClassNameGenerator,
} from '@mui/utils';
describe('generateUtilityClass', () => {
it('should generate the class correctly', () => {
expect(generateUtilityClass('MuiTest', 'slot')).to.... |
1,219 | 0 | petrpan-code/mui/material-ui/packages/mui-utils/src | petrpan-code/mui/material-ui/packages/mui-utils/src/generateUtilityClasses/generateUtilityClasses.test.ts | import { expect } from 'chai';
import { unstable_generateUtilityClasses as generateUtilityClasses } from '@mui/utils';
describe('generateUtilityClasses', () => {
it('should generate the classes correctly', () => {
expect(generateUtilityClasses('MuiTest', ['slot1', 'slot2'])).to.deep.equal({
slot1: 'MuiTest... |
1,296 | 0 | petrpan-code/mui/material-ui/packages/typescript-to-proptypes | petrpan-code/mui/material-ui/packages/typescript-to-proptypes/test/typescript-to-proptypes.test.ts | import path from 'path';
import fs from 'fs';
import * as ts from 'typescript';
import { expect } from 'chai';
import glob from 'fast-glob';
import prettier from 'prettier';
import {
TypeScriptProject,
createTypeScriptProjectBuilder,
} from '@mui-internal/api-docs-builder/utils/createTypeScriptProject';
import { ge... |
1,462 | 0 | petrpan-code/mui/material-ui | petrpan-code/mui/material-ui/test/tsconfig.json | {
"extends": "../tsconfig.json",
"compilerOptions": {
"allowJs": true,
"noUnusedLocals": true,
"skipLibCheck": true,
"esModuleInterop": true,
"moduleResolution": "node16",
"types": ["mocha"]
},
"include": ["e2e/**/*", "regressions/**/*"],
"exclude": ["node_modules", "*/build"]
}
|
1,519 | 0 | petrpan-code/mui/material-ui/test | petrpan-code/mui/material-ui/test/e2e/index.test.ts | import { expect } from 'chai';
import * as playwright from 'playwright';
import type {
ByRoleMatcher,
ByRoleOptions,
Matcher,
MatcherOptions,
SelectorMatcherOptions,
} from '@testing-library/dom';
import '@mui-internal/test-utils/initMatchers';
import '@mui-internal/test-utils/initPlaywrightMatchers';
functi... |
1,790 | 0 | petrpan-code/freeCodeCamp/freeCodeCamp | petrpan-code/freeCodeCamp/freeCodeCamp/api/jest.utils.test.ts | import { getCsrfToken } from './jest.utils';
const fakeCookies = [
'_csrf=123; Path=/; HttpOnly; SameSite=Strict',
'csrf_token=abc-123; Path=/',
'sessionId=CV-abc.123; Path=/; Expires=Wed, 03 May 2023 16:29:53 GMT; HttpOnly'
];
describe('getCsrfToken', () => {
test('returns csrf token if there is one', () => ... |
1,799 | 0 | petrpan-code/freeCodeCamp/freeCodeCamp/api | petrpan-code/freeCodeCamp/freeCodeCamp/api/src/schema.test.ts | import Ajv from 'ajv';
import secureSchema from 'ajv/lib/refs/json-schema-secure.json';
import { schemas } from './schemas';
// it's not strict, but that's okay - we're not using it to validate data
const ajv = new Ajv({ strictTypes: false });
const isSchemaSecure = ajv.compile(secureSchema);
// These schemas will f... |
1,801 | 0 | petrpan-code/freeCodeCamp/freeCodeCamp/api | petrpan-code/freeCodeCamp/freeCodeCamp/api/src/server.test.ts | import { setupServer, superRequest } from '../jest.utils';
import { HOME_LOCATION, COOKIE_DOMAIN } from './utils/env';
jest.mock('./utils/env', () => {
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return {
...jest.requireActual('./utils/env'),
COOKIE_DOMAIN: '.freecodecamp.org'
};
});
... |
1,805 | 0 | petrpan-code/freeCodeCamp/freeCodeCamp/api/src | petrpan-code/freeCodeCamp/freeCodeCamp/api/src/plugins/fastify-jwt-authz.test.ts | /*
MIT License
Copyright (c) 2018 Ethan Arrowood
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish,... |
1,807 | 0 | petrpan-code/freeCodeCamp/freeCodeCamp/api/src | petrpan-code/freeCodeCamp/freeCodeCamp/api/src/plugins/mailer.test.ts | import Fastify from 'fastify';
import mailer from './mailer';
describe('mailer', () => {
it('should throw if not given a provider', async () => {
const fastify = Fastify();
await expect(fastify.register(mailer)).rejects.toThrow(
"The mailer plugin must be passed a provider via register's options."
... |
1,809 | 0 | petrpan-code/freeCodeCamp/freeCodeCamp/api/src | petrpan-code/freeCodeCamp/freeCodeCamp/api/src/plugins/redirect-with-message.test.ts | import Fastify, { FastifyInstance } from 'fastify';
import qs from 'query-string';
import redirectWithMessage from './redirect-with-message';
async function setupServer() {
const fastify = Fastify();
await fastify.register(redirectWithMessage);
return fastify;
}
const isString = (value: unknown): value is stri... |
1,815 | 0 | petrpan-code/freeCodeCamp/freeCodeCamp/api/src | petrpan-code/freeCodeCamp/freeCodeCamp/api/src/routes/auth.test.ts | /* eslint-disable @typescript-eslint/no-unsafe-assignment */
import { defaultUserEmail, setupServer, superRequest } from '../../jest.utils';
describe('dev login', () => {
setupServer();
beforeEach(async () => {
await fastifyTestInstance.prisma.user.deleteMany({
where: { email: defaultUserEmail }
});
... |
1,817 | 0 | petrpan-code/freeCodeCamp/freeCodeCamp/api/src | petrpan-code/freeCodeCamp/freeCodeCamp/api/src/routes/challenge.test.ts | // Yes, putting this above the imports is a hack to get around the fact that
// jest.mock() must be called at the top level of the file.
const mockVerifyTrophyWithMicrosoft = jest.fn();
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
import { ... |
1,819 | 0 | petrpan-code/freeCodeCamp/freeCodeCamp/api/src | petrpan-code/freeCodeCamp/freeCodeCamp/api/src/routes/deprecated-endpoints.test.ts | import request from 'supertest';
import { setupServer } from '../../jest.utils';
import { endpoints } from './deprecated-endpoints';
describe('Deprecated endpoints', () => {
setupServer();
endpoints.forEach(([endpoint, method]) => {
test(`${method} ${endpoint} returns 410 status code with "info" message`, as... |
1,821 | 0 | petrpan-code/freeCodeCamp/freeCodeCamp/api/src | petrpan-code/freeCodeCamp/freeCodeCamp/api/src/routes/deprecated-unsubscribe.test.ts | import { setupServer, superRequest } from '../../jest.utils';
import { unsubscribeEndpoints } from './deprecated-unsubscribe';
const urlEncodedMessage =
'?messages=info%5B0%5D%3DWe%2520are%2520no%2520longer%2520able%2520to%2520process%2520this%2520unsubscription%2520request.%2520Please%2520go%2520to%2520your%2520se... |
1,823 | 0 | petrpan-code/freeCodeCamp/freeCodeCamp/api/src | petrpan-code/freeCodeCamp/freeCodeCamp/api/src/routes/donate.test.ts | /* eslint-disable @typescript-eslint/naming-convention */
import {
createSuperRequest,
devLogin,
setupServer,
superRequest
} from '../../jest.utils';
const chargeStripeCardReqBody = {
paymentMethodId: 'UID',
amount: 500,
duration: 'month'
};
const mockSubCreate = jest.fn();
const generateMockSubCreate = ... |
1,825 | 0 | petrpan-code/freeCodeCamp/freeCodeCamp/api/src | petrpan-code/freeCodeCamp/freeCodeCamp/api/src/routes/settings.test.ts | import {
devLogin,
setupServer,
superRequest,
createSuperRequest
} from '../../jest.utils';
import { createUserInput } from '../utils/create-user';
import { isPictureWithProtocol } from './settings';
const baseProfileUI = {
isLocked: false,
showAbout: false,
showCerts: false,
showDonation: false,
sh... |
1,827 | 0 | petrpan-code/freeCodeCamp/freeCodeCamp/api/src | petrpan-code/freeCodeCamp/freeCodeCamp/api/src/routes/status.test.ts | import { setupServer, superRequest } from '../../jest.utils';
describe('/status', () => {
setupServer();
test('GET returns 200 status code with pong', async () => {
const response = await superRequest('/status/ping', {
method: 'GET'
});
expect(response.body).toStrictEqual({ msg: 'pong' });
... |
1,829 | 0 | petrpan-code/freeCodeCamp/freeCodeCamp/api/src | petrpan-code/freeCodeCamp/freeCodeCamp/api/src/routes/user.test.ts | /* eslint-disable @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-unsafe-argument */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
import jwt, { JwtPayload } from 'jsonwebtoken';
import type { Prisma } from '@prisma/client';
import { ObjectId } from 'mongodb';
import... |
1,831 | 0 | petrpan-code/freeCodeCamp/freeCodeCamp/api/src/routes | petrpan-code/freeCodeCamp/freeCodeCamp/api/src/routes/helpers/challenge-helpers.test.ts | import type {
PartiallyCompletedChallenge,
CompletedChallenge
} from '@prisma/client';
import { createFetchMock } from '../../../jest.utils';
import {
canSubmitCodeRoadCertProject,
verifyTrophyWithMicrosoft
} from './challenge-helpers';
const id = 'abc';
const partiallyCompletedChallenges: PartiallyCompleted... |
1,840 | 0 | petrpan-code/freeCodeCamp/freeCodeCamp/api/src | petrpan-code/freeCodeCamp/freeCodeCamp/api/src/utils/exam.test.ts | import { Exam, Question } from '@prisma/client';
import {
examJson,
userExam1,
userExam2,
mockResults1,
mockResults2
} from '../../__mocks__/exam';
import { generateRandomExam, createExamResults } from './exam';
import { GeneratedExam, GeneratedQuestion } from './exam-types';
describe('Exam helpers', () => {... |
1,842 | 0 | petrpan-code/freeCodeCamp/freeCodeCamp/api/src | petrpan-code/freeCodeCamp/freeCodeCamp/api/src/utils/get-challenges.test.ts | import { getChallenges } from './get-challenges';
import { isObjectID } from './validation';
describe('getChallenges', () => {
test('returns an array of challenges', () => {
const challenges = getChallenges();
expect(Array.isArray(challenges)).toBe(true);
expect(challenges.length).toBeGreaterThan(0);
}... |
1,844 | 0 | petrpan-code/freeCodeCamp/freeCodeCamp/api/src | petrpan-code/freeCodeCamp/freeCodeCamp/api/src/utils/index.test.ts | import { base64URLEncode, challenge, verifier } from '.';
describe('utils', () => {
test('base64URLEncode', () => {
expect(base64URLEncode(Buffer.from('test'))).toEqual('dGVzdA');
});
test('verifier', () => {
expect(verifier).toHaveLength(43);
});
test('challenge', () => {
expect(challenge).toH... |
1,846 | 0 | petrpan-code/freeCodeCamp/freeCodeCamp/api/src | petrpan-code/freeCodeCamp/freeCodeCamp/api/src/utils/normalize.test.ts | import {
normalizeTwitter,
normalizeProfileUI,
normalizeChallenges
} from './normalize';
describe('normalize', () => {
describe('normalizeTwitter', () => {
it('returns the input if it is a url', () => {
const url = 'https://twitter.com/a_generic_user';
expect(normalizeTwitter(url)).toEqual(url)... |
1,848 | 0 | petrpan-code/freeCodeCamp/freeCodeCamp/api/src | petrpan-code/freeCodeCamp/freeCodeCamp/api/src/utils/progress.test.ts | import { getCalendar, getPoints } from './progress';
describe('utils/progress', () => {
describe('getCalendar', () => {
it('should return an empty object if no timestamps are passed', () => {
expect(getCalendar([])).toEqual({});
expect(getCalendar(null)).toEqual({});
});
it('should take times... |
1,851 | 0 | petrpan-code/freeCodeCamp/freeCodeCamp/api/src | petrpan-code/freeCodeCamp/freeCodeCamp/api/src/utils/validation.test.ts | import { isObjectID } from './validation';
describe('Validation', () => {
describe('isObjectID', () => {
it('returns true for valid ObjectIDs', () => {
expect(isObjectID('5f1e0f3b5d2c12b0b8f7a6b9')).toBe(true);
});
it('returns false for invalid ObjectIDs', () => {
expect(isObjectID('5f1e0f3b... |
1,864 | 0 | petrpan-code/freeCodeCamp/freeCodeCamp/client | petrpan-code/freeCodeCamp/freeCodeCamp/client/config/cert-and-project-map.test.ts | import { uniq } from 'lodash';
import {
currentCertifications,
upcomingCertifications,
legacyCertifications
} from '../../shared/config/certification-settings';
import {
currentCertTitles,
upcomingCertTitles,
legacyCertTitles
} from './cert-and-project-map';
describe('cert-and-project-map', () => {
descr... |
1,869 | 0 | petrpan-code/freeCodeCamp/freeCodeCamp/client | petrpan-code/freeCodeCamp/freeCodeCamp/client/i18n/locales.test.ts | import fs from 'fs';
import { setup } from 'jest-json-schema-extended';
import { availableLangs, LangNames, LangCodes } from '../../shared/config/i18n';
import { SuperBlocks } from '../../shared/config/superblocks';
import intro from './locales/english/intro.json';
setup();
interface Intro {
[key: string]: {
ti... |
1,940 | 0 | petrpan-code/freeCodeCamp/freeCodeCamp/client/src/__tests__ | petrpan-code/freeCodeCamp/freeCodeCamp/client/src/__tests__/integration/handled-error.test.ts | import {
wrapHandledError,
unwrapHandledError
} from '../../utils/handled-error';
describe('handled-error integration', () => {
const handledA = {
type: 'info',
message: 'something helpful',
redirectTo: '/a-path-we-choose'
};
const handledB = {
type: 'danger',
message: 'Oh noes!',
red... |
1,998 | 0 | petrpan-code/freeCodeCamp/freeCodeCamp/client/src | petrpan-code/freeCodeCamp/freeCodeCamp/client/src/client-only-routes/show-settings.test.tsx | /* eslint-disable */
// @ts-nocheck Likely need to not use ShallowRenderer
import React from 'react';
import ShallowRenderer from 'react-test-renderer/shallow';
import envData from '../../config/env.json';
import { ShowSettings } from './show-settings';
const { apiLocation } = envData as Record<string, string>;
jest... |
2,002 | 0 | petrpan-code/freeCodeCamp/freeCodeCamp/client/src | petrpan-code/freeCodeCamp/freeCodeCamp/client/src/components/app-mount-notifier.test.tsx | import { render, waitFor } from '@testing-library/react';
import React from 'react';
import { I18nextProvider } from 'react-i18next';
import { Provider } from 'react-redux';
import { i18nextCodes } from '../../../shared/config/i18n';
import i18nTestConfig from '../../i18n/config-for-tests';
import { createStore } from... |
2,004 | 0 | petrpan-code/freeCodeCamp/freeCodeCamp/client/src | petrpan-code/freeCodeCamp/freeCodeCamp/client/src/components/create-language-redirect.test.ts | import createLanguageRedirect from './create-language-redirect';
describe('createLanguageRedirect for clientLocale === english', () => {
const envVars = {
clientLocale: 'english'
};
describe('challenge page', () => {
const currentPageURL =
'https://www.freecodecamp.org/learn/responsive-web-design/... |
2,027 | 0 | petrpan-code/freeCodeCamp/freeCodeCamp/client/src/components | petrpan-code/freeCodeCamp/freeCodeCamp/client/src/components/Footer/footer.test.tsx | import React from 'react';
import renderer from 'react-test-renderer';
import Footer from '.';
describe('<Footer />', () => {
it('matches snapshot', () => {
const tree = renderer.create(<Footer />).toJSON();
expect(tree).toMatchSnapshot();
});
});
|
2,029 | 0 | petrpan-code/freeCodeCamp/freeCodeCamp/client/src/components/Footer | petrpan-code/freeCodeCamp/freeCodeCamp/client/src/components/Footer/__snapshots__/footer.test.tsx.snap | // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`<Footer /> matches snapshot 1`] = `
<footer
className="site-footer"
>
<div
className="footer-top"
>
<div
className="footer-desc-col"
data-playwright-test-label="footer-desc-col"
>
<p>
footer.tax-exempt-status
</p>
... |
2,033 | 0 | petrpan-code/freeCodeCamp/freeCodeCamp/client/src/components | petrpan-code/freeCodeCamp/freeCodeCamp/client/src/components/Header/header.test.tsx | /* eslint-disable @typescript-eslint/no-unsafe-assignment */
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-unsafe-return */
import React from 'react';
import { create, ReactTestRendererJSON } from 'react-test-renderer';
import AuthOrProfile from './components/a... |
2,047 | 0 | petrpan-code/freeCodeCamp/freeCodeCamp/client/src/components | petrpan-code/freeCodeCamp/freeCodeCamp/client/src/components/Intro/intro.test.tsx | import React from 'react';
import { Provider } from 'react-redux';
import renderer from 'react-test-renderer';
import { createStore } from '../../redux/create-store';
import Intro from '.';
jest.mock('../../analytics');
function rendererCreateWithRedux(ui: JSX.Element) {
return renderer.create(<Provider store={cre... |
2,054 | 0 | petrpan-code/freeCodeCamp/freeCodeCamp/client/src/components | petrpan-code/freeCodeCamp/freeCodeCamp/client/src/components/OfflineWarning/offline-warning.test.tsx | import React from 'react';
import { render, act, screen } from '@testing-library/react';
import OfflineWarning from './offline-warning';
jest.useFakeTimers();
describe('<OfflineWarning />', () => {
it('renders null when isOnline, isServerOnline and isSignedIn are true', () => {
const { container } = render(
... |
2,065 | 0 | petrpan-code/freeCodeCamp/freeCodeCamp/client/src/components | petrpan-code/freeCodeCamp/freeCodeCamp/client/src/components/formHelpers/form.test.tsx | import { render, fireEvent, screen } from '@testing-library/react';
import React from 'react';
import { StrictSolutionForm, StrictSolutionFormProps } from './form';
const defaultTestProps: StrictSolutionFormProps = {
buttonText: 'Submit',
formFields: [
{ name: 'name', label: 'name Label' },
{ name: 'websi... |
2,071 | 0 | petrpan-code/freeCodeCamp/freeCodeCamp/client/src/components | petrpan-code/freeCodeCamp/freeCodeCamp/client/src/components/helpers/border-color-picker.test.ts | import borderColorPicker from './border-color-picker';
describe('Border color picker helper', () => {
it('should get color for non donators and non top contributors', () => {
expect(borderColorPicker(false, false)).toEqual('default-border');
});
it('should get color for donators and top contributors', () =>... |
2,077 | 0 | petrpan-code/freeCodeCamp/freeCodeCamp/client/src/components | petrpan-code/freeCodeCamp/freeCodeCamp/client/src/components/helpers/link.test.tsx | /* eslint-disable @typescript-eslint/ban-ts-comment */
import React from 'react';
import { create } from 'react-test-renderer';
import Link from './link';
describe('<Link />', () => {
const externalLink = create(<Link external={true} to='/home' />).toJSON();
const gatsbyLink = create(<Link to='/home' />).toJSON()... |
2,080 | 0 | petrpan-code/freeCodeCamp/freeCodeCamp/client/src/components | petrpan-code/freeCodeCamp/freeCodeCamp/client/src/components/helpers/loader.test.tsx | import { render, cleanup, screen } from '@testing-library/react';
import React from 'react';
import Loader from './loader';
describe('<Loader />', () => {
afterEach(cleanup);
it('renders to the DOM', () => {
const { container } = render(<Loader />);
expect(container).toBeTruthy();
});
it('adds the c... |
2,086 | 0 | petrpan-code/freeCodeCamp/freeCodeCamp/client/src/components/helpers | petrpan-code/freeCodeCamp/freeCodeCamp/client/src/components/helpers/__snapshots__/loader.test.tsx.snap | // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`<Loader /> matches the fullScreen render snapshot 1`] = `
<div
class="fcc-loader full-screen-wrapper"
data-testid="fcc-loader"
>
<div
class="sk-fade-in sk-spinner line-scale-pulse-out"
>
<div />
<div />
<div />
<div />
<div />
</div>... |
2,087 | 0 | petrpan-code/freeCodeCamp/freeCodeCamp/client/src/components/helpers | petrpan-code/freeCodeCamp/freeCodeCamp/client/src/components/helpers/form/block-save-button.test.tsx | import { render, screen } from '@testing-library/react';
import React from 'react';
import BlockSaveButton from './block-save-button';
test('<BlockSaveButton /> snapshot', () => {
const { container } = render(<BlockSaveButton />);
expect(container).toMatchSnapshot();
});
test('Button text should default to the ... |
2,089 | 0 | petrpan-code/freeCodeCamp/freeCodeCamp/client/src/components/helpers/form | petrpan-code/freeCodeCamp/freeCodeCamp/client/src/components/helpers/form/__snapshots__/block-save-button.test.tsx.snap | // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`<BlockSaveButton /> snapshot 1`] = `
<div>
<button
class="btn btn-primary btn-block"
type="submit"
>
buttons.save
</button>
</div>
`;
|
2,092 | 0 | petrpan-code/freeCodeCamp/freeCodeCamp/client/src/components | petrpan-code/freeCodeCamp/freeCodeCamp/client/src/components/landing/landing.test.tsx | import React from 'react';
import { createRenderer } from 'react-test-renderer/shallow';
import mockChallengeNodes from '../../__mocks__/challenge-nodes';
import IndexPage from '../../pages';
jest.mock('../../analytics');
describe('<Landing />', () => {
it('renders when visiting index page and logged out', () => {... |
2,111 | 0 | petrpan-code/freeCodeCamp/freeCodeCamp/client/src/components | petrpan-code/freeCodeCamp/freeCodeCamp/client/src/components/profile/profile.test.tsx | import { render, screen } from '@testing-library/react';
import React from 'react';
import { Themes } from '../settings/theme';
import Profile from './profile';
jest.mock('../../analytics');
const userProps = {
user: {
acceptedPrivacyTerms: true,
currentChallengeId: 'string',
email: 'string',
email... |
2,113 | 0 | petrpan-code/freeCodeCamp/freeCodeCamp/client/src/components/profile | petrpan-code/freeCodeCamp/freeCodeCamp/client/src/components/profile/__snapshots__/profile.test.tsx.snap | // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`<Profile/> renders correctly 1`] = `
<div>
<div
class="spacer"
style="padding: 15px 0px;"
/>
<div
class="mx-auto px-[15px] my-0 md:w-[750px] min-[992px]:w-[970px] min-[1200px]:w-[1170px] "
>
<div
class="spacer"
style="padding: 15px... |
2,118 | 0 | petrpan-code/freeCodeCamp/freeCodeCamp/client/src/components/profile | petrpan-code/freeCodeCamp/freeCodeCamp/client/src/components/profile/components/heat-map.test.tsx | import { render, screen } from '@testing-library/react';
import React from 'react';
import HeatMap from './heat-map';
// offset is used to shift the dates so that the calendar renders (for testing
// purposes only) the same way in each timezone.
const offset = new Date().getTimezoneOffset() * 60;
const date1 = 158049... |
2,125 | 0 | petrpan-code/freeCodeCamp/freeCodeCamp/client/src/components/profile | petrpan-code/freeCodeCamp/freeCodeCamp/client/src/components/profile/components/time-line.test.tsx | /* eslint-disable @typescript-eslint/ban-ts-comment */
/* eslint-disable @typescript-eslint/no-unsafe-call */
import { useStaticQuery } from 'gatsby';
import React from 'react';
import { render, screen } from '../../../../utils/test-utils';
import { createStore } from '../../../redux/create-store';
import TimeLine fro... |
2,134 | 0 | petrpan-code/freeCodeCamp/freeCodeCamp/client/src/components/search | petrpan-code/freeCodeCamp/freeCodeCamp/client/src/components/search/searchBar/search-bar.test.tsx | import React from 'react';
import ShallowRenderer from 'react-test-renderer/shallow';
import { SearchBar } from './search-bar';
describe('<SearchBar />', () => {
it('renders to the DOM', () => {
const utils = ShallowRenderer.createRenderer();
utils.render(<SearchBar {...searchBarProps} />);
const view =... |
2,141 | 0 | petrpan-code/freeCodeCamp/freeCodeCamp/client/src/components | petrpan-code/freeCodeCamp/freeCodeCamp/client/src/components/seo/seo.test.tsx | import React from 'react';
import * as Gatsby from 'gatsby';
import { render } from '@testing-library/react';
import Helmet from 'react-helmet';
import SEO from './index';
const useStaticQuery = jest.spyOn(Gatsby, `useStaticQuery`);
const mockUseStaticQuery = {
site: {
siteMetadata: {
title: 'freeCodeCamp... |
2,144 | 0 | petrpan-code/freeCodeCamp/freeCodeCamp/client/src/components | petrpan-code/freeCodeCamp/freeCodeCamp/client/src/components/settings/certification.test.tsx | /* eslint-disable @typescript-eslint/no-empty-function */
import { render, screen } from '@testing-library/react';
import React from 'react';
import { Provider } from 'react-redux';
import { createStore } from '../../redux/create-store';
import { Ext } from '../../redux/prop-types';
import { verifyCert } from '../../re... |
2,151 | 0 | petrpan-code/freeCodeCamp/freeCodeCamp/client/src/components | petrpan-code/freeCodeCamp/freeCodeCamp/client/src/components/settings/honesty.test.tsx | import { Button } from '@freecodecamp/react-bootstrap';
import React from 'react';
import TestRenderer from 'react-test-renderer';
import ShallowRenderer from 'react-test-renderer/shallow';
import Honesty from './honesty';
describe('<Honesty />', () => {
const utils = ShallowRenderer.createRenderer();
const update... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.