level_0 int64 0 10k | index int64 0 0 | repo_id stringlengths 22 152 | file_path stringlengths 41 203 | content stringlengths 11 11.5M |
|---|---|---|---|---|
584 | 0 | petrpan-code/alibaba/hooks/packages/hooks/src/useWhyDidYouUpdate | petrpan-code/alibaba/hooks/packages/hooks/src/useWhyDidYouUpdate/__tests__/index.test.ts | import { renderHook, act } from '@testing-library/react';
import useWhyDidYouUpdate from '../index';
import { useState } from 'react';
describe('useWhyDidYouUpdate', () => {
it('should work', () => {
console.log = jest.fn();
const setup = () =>
renderHook(() => {
const [count, setCount] = useSt... |
617 | 0 | petrpan-code/alibaba/hooks/packages/use-url-state/src | petrpan-code/alibaba/hooks/packages/use-url-state/src/__tests__/browser.test.tsx | import { act } from '@testing-library/react';
import { setup } from '.';
describe('useUrlState', () => {
it('state should be url search params', () => {
const res = setup([
{
pathname: '/index',
search: '?count=1',
},
]);
expect(res.state).toMatchObject({ count: '1' });
});
... |
619 | 0 | petrpan-code/alibaba/hooks/packages/use-url-state/src | petrpan-code/alibaba/hooks/packages/use-url-state/src/__tests__/router.test.tsx | import { act } from '@testing-library/react';
import { setup } from '.';
describe('React Router V6', () => {
it('useUrlState should be work', () => {
const res = setup(['/index']);
act(() => {
res.setState({ count: 1 });
});
expect(res.state).toMatchObject({ count: '1' });
});
});
|
2,851 | 0 | petrpan-code/redwoodjs/redwood/__fixtures__/empty-project/api/src/directives | petrpan-code/redwoodjs/redwood/__fixtures__/empty-project/api/src/directives/requireAuth/requireAuth.test.ts | import { mockRedwoodDirective, getDirectiveName } from '@redwoodjs/testing/api'
import requireAuth from './requireAuth'
describe('requireAuth directive', () => {
it('declares the directive sdl as schema, with the correct name', () => {
expect(requireAuth.schema).toBeTruthy()
expect(getDirectiveName(requireA... |
2,853 | 0 | petrpan-code/redwoodjs/redwood/__fixtures__/empty-project/api/src/directives | petrpan-code/redwoodjs/redwood/__fixtures__/empty-project/api/src/directives/skipAuth/skipAuth.test.ts | import { getDirectiveName } from '@redwoodjs/testing/api'
import skipAuth from './skipAuth'
describe('skipAuth directive', () => {
it('declares the directive sdl as schema, with the correct name', () => {
expect(skipAuth.schema).toBeTruthy()
expect(getDirectiveName(skipAuth.schema)).toBe('skipAuth')
})
})... |
2,998 | 0 | petrpan-code/redwoodjs/redwood/__fixtures__/fragment-test-project/api/src/directives | petrpan-code/redwoodjs/redwood/__fixtures__/fragment-test-project/api/src/directives/requireAuth/requireAuth.test.ts | import { mockRedwoodDirective, getDirectiveName } from '@redwoodjs/testing/api'
import requireAuth from './requireAuth'
describe('requireAuth directive', () => {
it('declares the directive sdl as schema, with the correct name', () => {
expect(requireAuth.schema).toBeTruthy()
expect(getDirectiveName(requireA... |
3,000 | 0 | petrpan-code/redwoodjs/redwood/__fixtures__/fragment-test-project/api/src/directives | petrpan-code/redwoodjs/redwood/__fixtures__/fragment-test-project/api/src/directives/skipAuth/skipAuth.test.ts | import { getDirectiveName } from '@redwoodjs/testing/api'
import skipAuth from './skipAuth'
describe('skipAuth directive', () => {
it('declares the directive sdl as schema, with the correct name', () => {
expect(skipAuth.schema).toBeTruthy()
expect(getDirectiveName(skipAuth.schema)).toBe('skipAuth')
})
})... |
3,057 | 0 | petrpan-code/redwoodjs/redwood/__fixtures__/test-project-rsa/api/src/directives | petrpan-code/redwoodjs/redwood/__fixtures__/test-project-rsa/api/src/directives/requireAuth/requireAuth.test.ts | import { mockRedwoodDirective, getDirectiveName } from '@redwoodjs/testing/api'
import requireAuth from './requireAuth'
describe('requireAuth directive', () => {
it('declares the directive sdl as schema, with the correct name', () => {
expect(requireAuth.schema).toBeTruthy()
expect(getDirectiveName(requireA... |
3,059 | 0 | petrpan-code/redwoodjs/redwood/__fixtures__/test-project-rsa/api/src/directives | petrpan-code/redwoodjs/redwood/__fixtures__/test-project-rsa/api/src/directives/skipAuth/skipAuth.test.ts | import { getDirectiveName } from '@redwoodjs/testing/api'
import skipAuth from './skipAuth'
describe('skipAuth directive', () => {
it('declares the directive sdl as schema, with the correct name', () => {
expect(skipAuth.schema).toBeTruthy()
expect(getDirectiveName(skipAuth.schema)).toBe('skipAuth')
})
})... |
3,111 | 0 | petrpan-code/redwoodjs/redwood/__fixtures__/test-project-rsc-external-packages/api/src/directives | petrpan-code/redwoodjs/redwood/__fixtures__/test-project-rsc-external-packages/api/src/directives/requireAuth/requireAuth.test.ts | import { mockRedwoodDirective, getDirectiveName } from '@redwoodjs/testing/api'
import requireAuth from './requireAuth'
describe('requireAuth directive', () => {
it('declares the directive sdl as schema, with the correct name', () => {
expect(requireAuth.schema).toBeTruthy()
expect(getDirectiveName(requireA... |
3,113 | 0 | petrpan-code/redwoodjs/redwood/__fixtures__/test-project-rsc-external-packages/api/src/directives | petrpan-code/redwoodjs/redwood/__fixtures__/test-project-rsc-external-packages/api/src/directives/skipAuth/skipAuth.test.ts | import { getDirectiveName } from '@redwoodjs/testing/api'
import skipAuth from './skipAuth'
describe('skipAuth directive', () => {
it('declares the directive sdl as schema, with the correct name', () => {
expect(skipAuth.schema).toBeTruthy()
expect(getDirectiveName(skipAuth.schema)).toBe('skipAuth')
})
})... |
3,167 | 0 | petrpan-code/redwoodjs/redwood/__fixtures__/test-project/api/src | petrpan-code/redwoodjs/redwood/__fixtures__/test-project/api/src/__tests__/context.test.ts | test('Set a mock user on the context', async () => {
const user = {
id: 0o7,
name: 'Bond, James Bond',
email: 'totallyNotASpy@example.com',
roles: 'secret_agent',
}
mockCurrentUser(user)
expect(context.currentUser).toStrictEqual(user)
})
test('Context is isolated between tests', () => {
expec... |
3,168 | 0 | petrpan-code/redwoodjs/redwood/__fixtures__/test-project/api/src/directives | petrpan-code/redwoodjs/redwood/__fixtures__/test-project/api/src/directives/requireAuth/requireAuth.test.ts | import { mockRedwoodDirective, getDirectiveName } from '@redwoodjs/testing/api'
import requireAuth from './requireAuth'
describe('requireAuth directive', () => {
it('declares the directive sdl as schema, with the correct name', () => {
expect(requireAuth.schema).toBeTruthy()
expect(getDirectiveName(requireA... |
3,170 | 0 | petrpan-code/redwoodjs/redwood/__fixtures__/test-project/api/src/directives | petrpan-code/redwoodjs/redwood/__fixtures__/test-project/api/src/directives/skipAuth/skipAuth.test.ts | import { getDirectiveName } from '@redwoodjs/testing/api'
import skipAuth from './skipAuth'
describe('skipAuth directive', () => {
it('declares the directive sdl as schema, with the correct name', () => {
expect(skipAuth.schema).toBeTruthy()
expect(getDirectiveName(skipAuth.schema)).toBe('skipAuth')
})
})... |
3,181 | 0 | petrpan-code/redwoodjs/redwood/__fixtures__/test-project/api/src/services | petrpan-code/redwoodjs/redwood/__fixtures__/test-project/api/src/services/contacts/contacts.test.ts | import type { Contact } from '@prisma/client'
import {
contacts,
contact,
createContact,
updateContact,
deleteContact,
} from './contacts'
import type { StandardScenario } from './contacts.scenarios'
// Generated boilerplate tests do not account for all circumstances
// and can fail without adjustments, e.g... |
3,184 | 0 | petrpan-code/redwoodjs/redwood/__fixtures__/test-project/api/src/services | petrpan-code/redwoodjs/redwood/__fixtures__/test-project/api/src/services/posts/posts.test.ts | import type { Post } from '@prisma/client'
import { posts, post, createPost, updatePost, deletePost } from './posts'
import type { StandardScenario } from './posts.scenarios'
// Generated boilerplate tests do not account for all circumstances
// and can fail without adjustments, e.g. Float.
// Please refer ... |
3,187 | 0 | petrpan-code/redwoodjs/redwood/__fixtures__/test-project/api/src/services | petrpan-code/redwoodjs/redwood/__fixtures__/test-project/api/src/services/users/users.test.ts | import { user } from './users'
import type { StandardScenario } from './users.scenarios'
describe('users', () => {
scenario('returns a single user', async (scenario: StandardScenario) => {
const result = await user({ id: scenario.user.one.id })
expect(result).toEqual(scenario.user.one)
})
})
|
3,208 | 0 | petrpan-code/redwoodjs/redwood/__fixtures__/test-project/web/src/components | petrpan-code/redwoodjs/redwood/__fixtures__/test-project/web/src/components/Author/Author.test.tsx | import { render } from '@redwoodjs/testing/web'
import Author from './Author'
const author = {
email: 'test.user@email.com',
fullName: 'Test User',
}
// Improve this test with help from the Redwood Testing Doc:
// https://redwoodjs.com/docs/testing#testing-components
describe('Author', () => {
it('render... |
3,212 | 0 | petrpan-code/redwoodjs/redwood/__fixtures__/test-project/web/src/components | petrpan-code/redwoodjs/redwood/__fixtures__/test-project/web/src/components/AuthorCell/AuthorCell.test.tsx | import { render } from '@redwoodjs/testing/web'
import { Loading, Empty, Failure, Success } from './AuthorCell'
import { standard } from './AuthorCell.mock'
// Generated boilerplate tests do not account for all circumstances
// and can fail without adjustments, e.g. Float and DateTime types.
// Please refer... |
3,215 | 0 | petrpan-code/redwoodjs/redwood/__fixtures__/test-project/web/src/components | petrpan-code/redwoodjs/redwood/__fixtures__/test-project/web/src/components/BlogPost/BlogPost.test.tsx | import { render } from '@redwoodjs/testing/web'
import BlogPost from './BlogPost'
// Improve this test with help from the Redwood Testing Doc:
// https://redwoodjs.com/docs/testing#testing-components
describe('BlogPost', () => {
it('renders successfully', () => {
expect(() => {
render(<BlogPost />)
... |
3,219 | 0 | petrpan-code/redwoodjs/redwood/__fixtures__/test-project/web/src/components | petrpan-code/redwoodjs/redwood/__fixtures__/test-project/web/src/components/BlogPostCell/BlogPostCell.test.tsx | import { render } from '@redwoodjs/testing/web'
import { Loading, Empty, Failure, Success } from './BlogPostCell'
import { standard } from './BlogPostCell.mock'
// Generated boilerplate tests do not account for all circumstances
// and can fail without adjustments, e.g. Float and DateTime types.
// Please r... |
3,223 | 0 | petrpan-code/redwoodjs/redwood/__fixtures__/test-project/web/src/components | petrpan-code/redwoodjs/redwood/__fixtures__/test-project/web/src/components/BlogPostsCell/BlogPostsCell.test.tsx | import { render } from '@redwoodjs/testing/web'
import { Loading, Empty, Failure, Success } from './BlogPostsCell'
import { standard } from './BlogPostsCell.mock'
// Generated boilerplate tests do not account for all circumstances
// and can fail without adjustments, e.g. Float and DateTime types.
// Please... |
3,241 | 0 | petrpan-code/redwoodjs/redwood/__fixtures__/test-project/web/src/components | petrpan-code/redwoodjs/redwood/__fixtures__/test-project/web/src/components/WaterfallBlogPostCell/WaterfallBlogPostCell.test.tsx | import { render } from '@redwoodjs/testing/web'
import { Loading, Empty, Failure, Success } from './WaterfallBlogPostCell'
import { standard } from './WaterfallBlogPostCell.mock'
// Generated boilerplate tests do not account for all circumstances
// and can fail without adjustments, e.g. Float and DateTime types.
// ... |
3,244 | 0 | petrpan-code/redwoodjs/redwood/__fixtures__/test-project/web/src/layouts | petrpan-code/redwoodjs/redwood/__fixtures__/test-project/web/src/layouts/BlogLayout/BlogLayout.test.tsx | import { render } from '@redwoodjs/testing/web'
import BlogLayout from './BlogLayout'
// Improve this test with help from the Redwood Testing Doc:
// https://redwoodjs.com/docs/testing#testing-pages-layouts
describe('BlogLayout', () => {
it('renders successfully', () => {
expect(() => {
render(<BlogL... |
3,247 | 0 | petrpan-code/redwoodjs/redwood/__fixtures__/test-project/web/src | petrpan-code/redwoodjs/redwood/__fixtures__/test-project/web/src/lib/formatters.test.tsx | import { render, waitFor, screen } from '@redwoodjs/testing/web'
import {
formatEnum,
jsonTruncate,
truncate,
timeTag,
jsonDisplay,
checkboxInputTag,
} from './formatters'
describe('formatEnum', () => {
it('handles nullish values', () => {
expect(formatEnum(null)).toEqual('')
expect(formatEnum('... |
3,250 | 0 | petrpan-code/redwoodjs/redwood/__fixtures__/test-project/web/src/pages | petrpan-code/redwoodjs/redwood/__fixtures__/test-project/web/src/pages/AboutPage/AboutPage.test.tsx | import { render } from '@redwoodjs/testing/web'
import AboutPage from './AboutPage'
// Improve this test with help from the Redwood Testing Doc:
// https://redwoodjs.com/docs/testing#testing-pages-layouts
describe('AboutPage', () => {
it('renders successfully', () => {
expect(() => {
render(<AboutPag... |
3,254 | 0 | petrpan-code/redwoodjs/redwood/__fixtures__/test-project/web/src/pages | petrpan-code/redwoodjs/redwood/__fixtures__/test-project/web/src/pages/BlogPostPage/BlogPostPage.test.tsx | import { render } from '@redwoodjs/testing/web'
import BlogPostPage from './BlogPostPage'
// Improve this test with help from the Redwood Testing Doc:
// https://redwoodjs.com/docs/testing#testing-pages-layouts
describe('BlogPostPage', () => {
it('renders successfully', () => {
expect(() => {
render(... |
3,261 | 0 | petrpan-code/redwoodjs/redwood/__fixtures__/test-project/web/src/pages | petrpan-code/redwoodjs/redwood/__fixtures__/test-project/web/src/pages/ContactUsPage/ContactUsPage.test.tsx | import { render } from '@redwoodjs/testing/web'
import ContactUsPage from './ContactUsPage'
// Improve this test with help from the Redwood Testing Doc:
// https://redwoodjs.com/docs/testing#testing-pages-layouts
describe('ContactUsPage', () => {
it('renders successfully', () => {
expect(() => {
rend... |
3,264 | 0 | petrpan-code/redwoodjs/redwood/__fixtures__/test-project/web/src/pages | petrpan-code/redwoodjs/redwood/__fixtures__/test-project/web/src/pages/DoublePage/DoublePage.test.tsx | import { render } from '@redwoodjs/testing/web'
import DoublePage from './DoublePage'
// Improve this test with help from the Redwood Testing Doc:
// https://redwoodjs.com/docs/testing#testing-pages-layouts
describe('DoublePage', () => {
it('renders successfully', () => {
expect(() => {
render(<Doubl... |
3,269 | 0 | petrpan-code/redwoodjs/redwood/__fixtures__/test-project/web/src/pages | petrpan-code/redwoodjs/redwood/__fixtures__/test-project/web/src/pages/HomePage/HomePage.test.tsx | import { render } from '@redwoodjs/testing/web'
import HomePage from './HomePage'
// Improve this test with help from the Redwood Testing Doc:
// https://redwoodjs.com/docs/testing#testing-pages-layouts
describe('HomePage', () => {
it('renders successfully', () => {
expect(() => {
render(<HomePage />... |
3,278 | 0 | petrpan-code/redwoodjs/redwood/__fixtures__/test-project/web/src/pages | petrpan-code/redwoodjs/redwood/__fixtures__/test-project/web/src/pages/ProfilePage/ProfilePage.test.tsx | import { render, waitFor, screen } from '@redwoodjs/testing/web'
import ProfilePage from './ProfilePage'
describe('ProfilePage', () => {
it('renders successfully', async () => {
mockCurrentUser({
email: 'danny@bazinga.com',
id: 84849020,
roles: 'BAZINGA',
})
await waitFor(async () => ... |
3,284 | 0 | petrpan-code/redwoodjs/redwood/__fixtures__/test-project/web/src/pages | petrpan-code/redwoodjs/redwood/__fixtures__/test-project/web/src/pages/WaterfallPage/WaterfallPage.test.tsx | import { render } from '@redwoodjs/testing/web'
import WaterfallPage from './WaterfallPage'
// Improve this test with help from the Redwood Testing Doc:
// https://redwoodjs.com/docs/testing#testing-pages-layouts
describe('WaterfallPage', () => {
it('renders successfully', () => {
expect(() => {
rend... |
4,033 | 0 | petrpan-code/redwoodjs/redwood/packages | petrpan-code/redwoodjs/redwood/packages/api-server/dist.test.ts | import fs from 'fs'
import path from 'path'
const distPath = path.join(__dirname, 'dist')
const packageConfig = JSON.parse(fs.readFileSync('./package.json', 'utf-8'))
describe('dist', () => {
it("shouldn't have the __tests__ directory", () => {
expect(fs.existsSync(path.join(distPath, '__tests__'))).toEqual(fal... |
4,043 | 0 | petrpan-code/redwoodjs/redwood/packages/api-server/src | petrpan-code/redwoodjs/redwood/packages/api-server/src/__tests__/fastify.test.ts | import fastify from 'fastify'
import { vol } from 'memfs'
import { createFastifyInstance, DEFAULT_OPTIONS } from '../fastify'
// We'll be testing how fastify is instantiated, so we'll mock it here.
jest.mock('fastify', () => {
return jest.fn(() => {
return {
register: () => {},
}
})
})
// Suppress ... |
4,044 | 0 | petrpan-code/redwoodjs/redwood/packages/api-server/src | petrpan-code/redwoodjs/redwood/packages/api-server/src/__tests__/lambdaLoader.test.ts | import path from 'path'
import {
LAMBDA_FUNCTIONS,
loadFunctionsFromDist,
} from '../plugins/lambdaLoader'
// Suppress terminal logging.
console.log = jest.fn()
console.warn = jest.fn()
// Set up RWJS_CWD.
let original_RWJS_CWD
beforeAll(() => {
original_RWJS_CWD = process.env.RWJS_CWD
process.env.RWJS_CWD ... |
4,045 | 0 | petrpan-code/redwoodjs/redwood/packages/api-server/src | petrpan-code/redwoodjs/redwood/packages/api-server/src/__tests__/lambdaLoaderNumberFunctions.test.ts | import path from 'path'
import {
LAMBDA_FUNCTIONS,
loadFunctionsFromDist,
} from '../plugins/lambdaLoader'
// Suppress terminal logging.
console.log = jest.fn()
// Set up RWJS_CWD.
let original_RWJS_CWD
beforeAll(() => {
original_RWJS_CWD = process.env.RWJS_CWD
process.env.RWJS_CWD = path.resolve(
__dir... |
4,046 | 0 | petrpan-code/redwoodjs/redwood/packages/api-server/src | petrpan-code/redwoodjs/redwood/packages/api-server/src/__tests__/logFormatter.test.ts | import { LogFormatter } from '../logFormatter/index'
const logFormatter = LogFormatter()
describe('LogFormatter', () => {
describe('Formats log levels as emoji', () => {
it('Formats Trace level', () => {
expect(logFormatter({ level: 10 })).toMatch('🧵')
})
it('Formats Debug level', () => {
... |
4,047 | 0 | petrpan-code/redwoodjs/redwood/packages/api-server/src | petrpan-code/redwoodjs/redwood/packages/api-server/src/__tests__/withApiProxy.test.ts | import httpProxy from '@fastify/http-proxy'
import type { FastifyInstance } from 'fastify'
import withApiProxy from '../plugins/withApiProxy'
test('withApiProxy registers `@fastify/http-proxy`', async () => {
const mockedFastifyInstance = {
register: jest.fn(),
}
// `apiUrl` is unfortunately named. It isn'... |
4,048 | 0 | petrpan-code/redwoodjs/redwood/packages/api-server/src | petrpan-code/redwoodjs/redwood/packages/api-server/src/__tests__/withFunctions.test.ts | import path from 'path'
import createFastifyInstance from '../fastify'
import withFunctions from '../plugins/withFunctions'
// Suppress terminal logging.
console.log = jest.fn()
console.warn = jest.fn()
// Set up RWJS_CWD.
let original_RWJS_CWD
beforeAll(() => {
original_RWJS_CWD = process.env.RWJS_CWD
process.... |
4,049 | 0 | petrpan-code/redwoodjs/redwood/packages/api-server/src | petrpan-code/redwoodjs/redwood/packages/api-server/src/__tests__/withWebServer.test.ts | import fs from 'fs'
import path from 'path'
import { getPaths } from '@redwoodjs/project-config'
import { createFastifyInstance } from '../fastify'
import withWebServer from '../plugins/withWebServer'
// Suppress terminal logging.
console.log = jest.fn()
// Set up RWJS_CWD.
let original_RWJS_CWD
beforeAll(() => {
... |
4,050 | 0 | petrpan-code/redwoodjs/redwood/packages/api-server/src | petrpan-code/redwoodjs/redwood/packages/api-server/src/__tests__/withWebServerFallback.test.ts | import fs from 'fs'
import path from 'path'
import { getPaths } from '@redwoodjs/project-config'
import { createFastifyInstance } from '../fastify'
import withWebServer from '../plugins/withWebServer'
// Set up RWJS_CWD.
let original_RWJS_CWD
beforeAll(() => {
original_RWJS_CWD = process.env.RWJS_CWD
process.en... |
4,051 | 0 | petrpan-code/redwoodjs/redwood/packages/api-server/src | petrpan-code/redwoodjs/redwood/packages/api-server/src/__tests__/withWebServerLoadFastifyConfig.test.ts | import { vol } from 'memfs'
import { createFastifyInstance } from '../fastify'
import withWebServer from '../plugins/withWebServer'
// Suppress terminal logging.
console.log = jest.fn()
// Set up RWJS_CWD.
let original_RWJS_CWD
const FIXTURE_PATH = '/redwood-app'
beforeAll(() => {
original_RWJS_CWD = process.env.... |
4,052 | 0 | petrpan-code/redwoodjs/redwood/packages/api-server/src | petrpan-code/redwoodjs/redwood/packages/api-server/src/__tests__/withWebServerLoadFastifyConfigError.test.ts | import { vol } from 'memfs'
import { createFastifyInstance } from '../fastify'
import withWebServer from '../plugins/withWebServer'
// Suppress terminal logging.
console.log = jest.fn()
// Set up RWJS_CWD.
let original_RWJS_CWD
const FIXTURE_PATH = '/redwood-app'
beforeAll(() => {
original_RWJS_CWD = process.env.... |
4,080 | 0 | petrpan-code/redwoodjs/redwood/packages/api-server/src/__tests__ | petrpan-code/redwoodjs/redwood/packages/api-server/src/__tests__/requestHandlers/awsLambdaFastify.test.ts | import type { FastifyRequest, FastifyReply } from 'fastify'
import { requestHandler } from '../../requestHandlers/awsLambdaFastify'
describe('Tests AWS Lambda to Fastify request transformation and handling', () => {
beforeEach(() => {
jest.clearAllMocks()
})
const request = {
method: 'GET',
body: '... |
4,081 | 0 | petrpan-code/redwoodjs/redwood/packages/api-server/src/__tests__ | petrpan-code/redwoodjs/redwood/packages/api-server/src/__tests__/requestHandlers/utils.test.ts | import { parseBody, mergeMultiValueHeaders } from '../../requestHandlers/utils'
describe('Tests AWS Lambda to Fastify utility functions', () => {
describe('Tests parseBody', () => {
test('with a string', () => {
const parsed = parseBody('foo')
expect(parsed).toEqual({ body: 'foo', isBase64Encoded: fa... |
4,110 | 0 | petrpan-code/redwoodjs/redwood/packages/api/src | petrpan-code/redwoodjs/redwood/packages/api/src/__tests__/normalizeRequest.test.ts | import { Headers } from '@whatwg-node/fetch'
import type { APIGatewayProxyEvent } from 'aws-lambda'
import { normalizeRequest } from '../transforms'
export const createMockedEvent = (
httpMethod = 'POST',
body: any = undefined,
isBase64Encoded = false
): APIGatewayProxyEvent => {
return {
body,
header... |
4,111 | 0 | petrpan-code/redwoodjs/redwood/packages/api/src | petrpan-code/redwoodjs/redwood/packages/api/src/__tests__/transforms.test.ts | import { removeNulls } from '../transforms'
describe('removeNulls utility', () => {
it('Changes nulls to undefined', () => {
const input = {
a: null,
b: 'b',
c: {
d: null, // nested null
e: 3,
f: {
g: null, // deeply nested null
h: [null, null], // ar... |
4,114 | 0 | petrpan-code/redwoodjs/redwood/packages/api/src/auth | petrpan-code/redwoodjs/redwood/packages/api/src/auth/__tests__/getAuthenticationContext.test.ts | import type { APIGatewayProxyEvent, Context } from 'aws-lambda'
import { getAuthenticationContext } from '../index'
export const createMockedEvent = ({
authProvider,
}: {
authProvider: string
}): APIGatewayProxyEvent => {
return {
body: null,
headers: {
'auth-provider': authProvider,
authori... |
4,115 | 0 | petrpan-code/redwoodjs/redwood/packages/api/src/auth | petrpan-code/redwoodjs/redwood/packages/api/src/auth/__tests__/parseJWT.test.ts | import { parseJWT } from '../parseJWT'
const JWT_CLAIMS: Record<string, unknown> = {
iss: 'https://app.us.auth0.com/',
sub: 'email|1234',
aud: ['https://example.com', 'https://app.us.auth0.com/userinfo'],
iat: 1596481520,
exp: 1596567920,
azp: '1l0w6JXXXXL880T',
scope: 'openid profile email',
}
const JW... |
4,126 | 0 | petrpan-code/redwoodjs/redwood/packages/api/src/auth/verifiers | petrpan-code/redwoodjs/redwood/packages/api/src/auth/verifiers/__tests__/base64Sha1Verifier.test.ts | import { createVerifier, WebhookVerificationError } from '../index'
const stringPayload = 'No more secrets, Marty.'
const payload = { data: { move: 'Sneakers', quote: stringPayload } }
const secret = 'MY_VOICE_IS_MY_PASSPORT_VERIFY_ME'
const { sign, verify } = createVerifier('base64Sha1Verifier')
describe('base64 sh... |
4,127 | 0 | petrpan-code/redwoodjs/redwood/packages/api/src/auth/verifiers | petrpan-code/redwoodjs/redwood/packages/api/src/auth/verifiers/__tests__/base64Sha256Verifier.test.ts | import { createVerifier, WebhookVerificationError } from '../index'
const stringPayload = 'No more secrets, Marty.'
const payload = { data: { move: 'Sneakers', quote: stringPayload } }
const secret = 'MY_VOICE_IS_MY_PASSPORT_VERIFY_ME'
const { sign, verify } = createVerifier('base64Sha256Verifier')
describe('base64 ... |
4,128 | 0 | petrpan-code/redwoodjs/redwood/packages/api/src/auth/verifiers | petrpan-code/redwoodjs/redwood/packages/api/src/auth/verifiers/__tests__/jwtVerifier.test.ts | import {
createVerifier,
WebhookSignError,
WebhookVerificationError,
} from '../index'
const payload = { data: 'No more secrets, Marty.' }
const secret = 'MY_VOICE_IS_MY_PASSPORT_VERIFY_ME'
describe('jwtVerifier verifier', () => {
describe('signs a payload', () => {
test('it has a signature', () => {
... |
4,129 | 0 | petrpan-code/redwoodjs/redwood/packages/api/src/auth/verifiers | petrpan-code/redwoodjs/redwood/packages/api/src/auth/verifiers/__tests__/secretKeyVerifier.test.ts | import { createVerifier, WebhookVerificationError } from '../index'
const payload = 'No more secrets, Marty.'
const secret = 'MY_VOICE_IS_MY_PASSPORT_VERIFY_ME'
const { sign, verify } = createVerifier('secretKeyVerifier')
beforeEach(() => {
jest.spyOn(console, 'warn').mockImplementation(jest.fn())
})
afterEach(()... |
4,130 | 0 | petrpan-code/redwoodjs/redwood/packages/api/src/auth/verifiers | petrpan-code/redwoodjs/redwood/packages/api/src/auth/verifiers/__tests__/sha1Verifier.test.ts | import { createVerifier, WebhookVerificationError } from '../index'
const stringPayload = 'No more secrets, Marty.'
const payload = { data: { move: 'Sneakers', quote: stringPayload } }
const secret = 'MY_VOICE_IS_MY_PASSPORT_VERIFY_ME'
const { sign, verify } = createVerifier('sha1Verifier')
describe('sha1 verifier',... |
4,131 | 0 | petrpan-code/redwoodjs/redwood/packages/api/src/auth/verifiers | petrpan-code/redwoodjs/redwood/packages/api/src/auth/verifiers/__tests__/sha256Verifier.test.ts | import { createVerifier, WebhookVerificationError } from '../index'
const stringPayload = 'No more secrets, Marty.'
const payload = { data: { move: 'Sneakers', quote: stringPayload } }
const secret = 'MY_VOICE_IS_MY_PASSPORT_VERIFY_ME'
const { sign, verify } = createVerifier('sha256Verifier')
describe('sha256 verifi... |
4,132 | 0 | petrpan-code/redwoodjs/redwood/packages/api/src/auth/verifiers | petrpan-code/redwoodjs/redwood/packages/api/src/auth/verifiers/__tests__/skipVerifier.test.ts | import { createVerifier } from '../index'
const payload = 'No more secrets, Marty.'
const secret = 'MY_VOICE_IS_MY_PASSPORT_VERIFY_ME'
const { sign, verify } = createVerifier('skipVerifier')
beforeEach(() => {
jest.spyOn(console, 'warn').mockImplementation(jest.fn())
})
afterEach(() => {
jest.spyOn(console, 'wa... |
4,133 | 0 | petrpan-code/redwoodjs/redwood/packages/api/src/auth/verifiers | petrpan-code/redwoodjs/redwood/packages/api/src/auth/verifiers/__tests__/timestampSchemeVerifier.test.ts | // import type { APIGatewayProxyEvent } from 'aws-lambda'
import { createVerifier, WebhookVerificationError } from '../index'
const payload = 'No more secrets, Marty.'
const secret = 'MY_VOICE_IS_MY_PASSPORT_VERIFY_ME'
describe('timestampScheme verifier', () => {
describe('signs a payload with default timestamp', ... |
4,139 | 0 | petrpan-code/redwoodjs/redwood/packages/api/src/cache | petrpan-code/redwoodjs/redwood/packages/api/src/cache/__tests__/cache.test.ts | import InMemoryClient from '../clients/InMemoryClient'
import { createCache } from '../index'
describe('cache', () => {
it('adds a missing key to the cache', async () => {
const client = new InMemoryClient()
const { cache } = createCache(client)
const result = await cache('test', () => {
return { ... |
4,140 | 0 | petrpan-code/redwoodjs/redwood/packages/api/src/cache | petrpan-code/redwoodjs/redwood/packages/api/src/cache/__tests__/cacheFindMany.test.ts | import { PrismaClient } from '@prisma/client'
import InMemoryClient from '../clients/InMemoryClient'
import { createCache } from '../index'
const mockFindFirst = jest.fn()
const mockFindMany = jest.fn()
jest.mock('@prisma/client', () => ({
PrismaClient: jest.fn(() => ({
user: {
findFirst: mockFindFirst,
... |
4,142 | 0 | petrpan-code/redwoodjs/redwood/packages/api/src/cache | petrpan-code/redwoodjs/redwood/packages/api/src/cache/__tests__/disconnect.test.ts | import InMemoryClient from '../clients/InMemoryClient'
import { CacheTimeoutError } from '../errors'
import { createCache } from '../index'
describe('client.disconnect', () => {
beforeEach(() => {
jest.clearAllMocks()
})
it('attempts to disconnect on timeout error', async () => {
const client = new InMe... |
4,143 | 0 | petrpan-code/redwoodjs/redwood/packages/api/src/cache | petrpan-code/redwoodjs/redwood/packages/api/src/cache/__tests__/shared.test.ts | import { createCache, formatCacheKey, InMemoryClient } from '../index'
describe('exports', () => {
it('exports the client that was passed in', () => {
const client = new InMemoryClient()
const { cacheClient } = createCache(client)
expect(cacheClient).toEqual(client)
})
})
describe('formatCacheKey', (... |
4,151 | 0 | petrpan-code/redwoodjs/redwood/packages/api/src | petrpan-code/redwoodjs/redwood/packages/api/src/logger/logger.test.ts | import { existsSync, readFileSync, statSync } from 'fs'
import os from 'os'
import { join } from 'path'
import split from 'split2'
const pid = process.pid
const hostname = os.hostname()
import { createLogger, emitLogLevels } from '../logger'
import type { LoggerOptions, BaseLogger } from '../logger'
const once = (e... |
4,156 | 0 | petrpan-code/redwoodjs/redwood/packages/api/src | petrpan-code/redwoodjs/redwood/packages/api/src/webhooks/webhooks.test.ts | import type { APIGatewayProxyEvent } from 'aws-lambda'
import {
signPayload,
verifyEvent,
verifySignature,
WebhookVerificationError,
DEFAULT_WEBHOOK_SIGNATURE_HEADER,
} from './index'
const payload = 'No more secrets, Marty.'
const secret = 'MY_VOICE_IS_MY_PASSPORT_VERIFY_ME'
const ONE_MINUTE = 60_000
const... |
4,166 | 0 | petrpan-code/redwoodjs/redwood/packages/auth-providers/auth0/api/src | petrpan-code/redwoodjs/redwood/packages/auth-providers/auth0/api/src/__tests__/auth0.test.ts | import jwt from 'jsonwebtoken'
import { verifyAuth0Token } from '../decoder'
jest.mock('jsonwebtoken', () => ({
verify: jest.fn(),
decode: jest.fn(),
}))
test('verify, and not decode, should be called in production', () => {
const { NODE_ENV } = process.env
process.env.NODE_ENV = 'production'
process.env.A... |
4,175 | 0 | petrpan-code/redwoodjs/redwood/packages/auth-providers/auth0/setup/src | petrpan-code/redwoodjs/redwood/packages/auth-providers/auth0/setup/src/__tests__/setup.test.ts | import { command, description, builder, handler } from '../setup'
// mock Telemetry for CLI commands so they don't try to spawn a process
jest.mock('@redwoodjs/telemetry', () => {
return {
errorTelemetry: () => jest.fn(),
timedTelemetry: () => jest.fn(),
}
})
test('standard exports', () => {
expect(comm... |
4,185 | 0 | petrpan-code/redwoodjs/redwood/packages/auth-providers/auth0/web/src | petrpan-code/redwoodjs/redwood/packages/auth-providers/auth0/web/src/__tests__/auth0.test.tsx | import type {
Auth0Client,
GetTokenSilentlyOptions,
GetTokenSilentlyVerboseResponse,
User,
} from '@auth0/auth0-spa-js'
import { renderHook, act } from '@testing-library/react'
import type { CurrentUser } from '@redwoodjs/auth'
import { createAuth } from '../auth0'
const user: User = {
sub: 'unique_user_id... |
4,193 | 0 | petrpan-code/redwoodjs/redwood/packages/auth-providers/azureActiveDirectory/api/src | petrpan-code/redwoodjs/redwood/packages/auth-providers/azureActiveDirectory/api/src/__tests__/azureActiveDirectory.test.ts | import type { APIGatewayProxyEvent, Context as LambdaContext } from 'aws-lambda'
import jwt from 'jsonwebtoken'
import { authDecoder } from '../decoder'
jest.mock('jsonwebtoken', () => ({
verify: jest.fn(),
decode: jest.fn(),
}))
const req = {
event: {} as APIGatewayProxyEvent,
context: {} as LambdaContext,
... |
4,202 | 0 | petrpan-code/redwoodjs/redwood/packages/auth-providers/azureActiveDirectory/setup/src | petrpan-code/redwoodjs/redwood/packages/auth-providers/azureActiveDirectory/setup/src/__tests__/setup.test.ts | import { command, description, builder, handler } from '../setup'
// mock Telemetry for CLI commands so they don't try to spawn a process
jest.mock('@redwoodjs/telemetry', () => {
return {
errorTelemetry: () => jest.fn(),
timedTelemetry: () => jest.fn(),
}
})
test('standard exports', () => {
expect(comm... |
4,212 | 0 | petrpan-code/redwoodjs/redwood/packages/auth-providers/azureActiveDirectory/web/src | petrpan-code/redwoodjs/redwood/packages/auth-providers/azureActiveDirectory/web/src/__tests__/azureActiveDirectory.test.tsx | import type {
AccountInfo,
PublicClientApplication as AzureActiveDirectoryClient,
RedirectRequest,
} from '@azure/msal-browser'
import { renderHook, act } from '@testing-library/react'
import type { CurrentUser } from '@redwoodjs/auth'
import { createAuth } from '../azureActiveDirectory'
const user: AccountInf... |
4,220 | 0 | petrpan-code/redwoodjs/redwood/packages/auth-providers/clerk/api/src | petrpan-code/redwoodjs/redwood/packages/auth-providers/clerk/api/src/__tests__/clerk.test.ts | import type { APIGatewayProxyEvent, Context as LambdaContext } from 'aws-lambda'
import { authDecoder, clerkAuthDecoder } from '../decoder'
const req = {
event: {} as APIGatewayProxyEvent,
context: {} as LambdaContext,
}
let consoleError
beforeAll(() => {
consoleError = console.error
console.error = () => {... |
4,238 | 0 | petrpan-code/redwoodjs/redwood/packages/auth-providers/clerk/web/src | petrpan-code/redwoodjs/redwood/packages/auth-providers/clerk/web/src/__tests__/clerk.test.tsx | import type {
Clerk as ClerkClient,
UserResource,
EmailAddressResource,
ActiveSessionResource,
} from '@clerk/types'
import { renderHook, act } from '@testing-library/react'
import type { CurrentUser } from '@redwoodjs/auth'
import { createAuth } from '../clerk'
const user: Partial<UserResource> = {
id: 'u... |
4,247 | 0 | petrpan-code/redwoodjs/redwood/packages/auth-providers/custom/setup/src | petrpan-code/redwoodjs/redwood/packages/auth-providers/custom/setup/src/__tests__/setup.test.ts | import { command, description, builder, handler } from '../setup'
// mock Telemetry for CLI commands so they don't try to spawn a process
jest.mock('@redwoodjs/telemetry', () => {
return {
errorTelemetry: () => jest.fn(),
timedTelemetry: () => jest.fn(),
}
})
test('standard exports', () => {
expect(comm... |
4,261 | 0 | petrpan-code/redwoodjs/redwood/packages/auth-providers/dbAuth/api/src | petrpan-code/redwoodjs/redwood/packages/auth-providers/dbAuth/api/src/__tests__/shared.test.ts | import crypto from 'node:crypto'
import path from 'node:path'
import type { APIGatewayProxyEvent } from 'aws-lambda'
import * as error from '../errors'
import {
extractCookie,
getSession,
cookieName,
hashPassword,
isLegacySession,
legacyHashPassword,
decryptSession,
dbAuthSession,
webAuthnSession,
... |
4,287 | 0 | petrpan-code/redwoodjs/redwood/packages/auth-providers/dbAuth/web/src | petrpan-code/redwoodjs/redwood/packages/auth-providers/dbAuth/web/src/__tests__/dbAuth.test.ts | import { renderHook, act } from '@testing-library/react'
import type { CurrentUser } from '@redwoodjs/auth'
import type { DbAuthClientArgs } from '../dbAuth'
import { createDbAuthClient, createAuth } from '../dbAuth'
globalThis.RWJS_API_URL = '/.redwood/functions'
globalThis.RWJS_API_GRAPHQL_URL = '/.redwood/functio... |
4,288 | 0 | petrpan-code/redwoodjs/redwood/packages/auth-providers/dbAuth/web/src | petrpan-code/redwoodjs/redwood/packages/auth-providers/dbAuth/web/src/__tests__/webAuthn.test.ts | import WebAuthnClient from '../webAuthn'
globalThis.RWJS_API_URL = '/.redwood/functions'
jest.mock('@whatwg-node/fetch', () => {
return
})
const mockOpen = jest.fn()
const mockSend = jest.fn()
const xhrMock: Partial<XMLHttpRequest> = {
open: mockOpen,
send: mockSend,
setRequestHeader: jest.fn(),
readyStat... |
4,298 | 0 | petrpan-code/redwoodjs/redwood/packages/auth-providers/firebase/api/src | petrpan-code/redwoodjs/redwood/packages/auth-providers/firebase/api/src/__tests__/firebase.test.ts | import type { APIGatewayProxyEvent, Context as LambdaContext } from 'aws-lambda'
import admin from 'firebase-admin'
import { authDecoder } from '../decoder'
const verifyIdToken = jest.fn()
jest.spyOn(admin, 'auth').mockImplementation((() => {
return {
verifyIdToken,
}
}) as any)
const req = {
event: {} as... |
4,307 | 0 | petrpan-code/redwoodjs/redwood/packages/auth-providers/firebase/setup/src | petrpan-code/redwoodjs/redwood/packages/auth-providers/firebase/setup/src/__tests__/setup.test.ts | import { command, description, builder, handler } from '../setup'
// mock Telemetry for CLI commands so they don't try to spawn a process
jest.mock('@redwoodjs/telemetry', () => {
return {
errorTelemetry: () => jest.fn(),
timedTelemetry: () => jest.fn(),
}
})
test('standard exports', () => {
expect(comm... |
4,318 | 0 | petrpan-code/redwoodjs/redwood/packages/auth-providers/firebase/web/src | petrpan-code/redwoodjs/redwood/packages/auth-providers/firebase/web/src/__tests__/firebase.test.tsx | import { renderHook, act } from '@testing-library/react'
import type FirebaseAuthNamespace from 'firebase/auth'
import type { User, OAuthProvider, Auth } from 'firebase/auth'
import { OperationType } from 'firebase/auth'
import type { CurrentUser } from '@redwoodjs/auth'
import type { FirebaseClient } from '../fireba... |
4,326 | 0 | petrpan-code/redwoodjs/redwood/packages/auth-providers/netlify/api/src | petrpan-code/redwoodjs/redwood/packages/auth-providers/netlify/api/src/__tests__/netlify.test.ts | import type { APIGatewayProxyEvent, Context as LambdaContext } from 'aws-lambda'
import jwt from 'jsonwebtoken'
import { authDecoder } from '../decoder'
jest.mock('jsonwebtoken', () => {
const jsonwebtoken = jest.requireActual('jsonwebtoken')
return {
...jsonwebtoken,
verify: jest.fn(),
decode: jest.... |
4,335 | 0 | petrpan-code/redwoodjs/redwood/packages/auth-providers/netlify/setup/src | petrpan-code/redwoodjs/redwood/packages/auth-providers/netlify/setup/src/__tests__/setup.test.ts | import { command, description, builder, handler } from '../setup'
// mock Telemetry for CLI commands so they don't try to spawn a process
jest.mock('@redwoodjs/telemetry', () => {
return {
errorTelemetry: () => jest.fn(),
timedTelemetry: () => jest.fn(),
}
})
test('standard exports', () => {
expect(comm... |
4,345 | 0 | petrpan-code/redwoodjs/redwood/packages/auth-providers/netlify/web/src | petrpan-code/redwoodjs/redwood/packages/auth-providers/netlify/web/src/__tests__/netlify.test.tsx | import { renderHook, act } from '@testing-library/react'
import type * as NetlifyIdentityNS from 'netlify-identity-widget'
import type { CurrentUser } from '@redwoodjs/auth'
import { createAuth } from '../netlify'
type NetlifyIdentity = typeof NetlifyIdentityNS
type User = NetlifyIdentityNS.User
const user: Partial... |
4,353 | 0 | petrpan-code/redwoodjs/redwood/packages/auth-providers/supabase/api/src | petrpan-code/redwoodjs/redwood/packages/auth-providers/supabase/api/src/__tests__/supabase.test.ts | import type { APIGatewayProxyEvent, Context as LambdaContext } from 'aws-lambda'
import jwt from 'jsonwebtoken'
import { authDecoder } from '../decoder'
jest.mock('jsonwebtoken', () => {
return {
verify: jest.fn(() => {
return {
sub: 'abc123',
}
}),
decode: jest.fn(),
}
})
const r... |
4,371 | 0 | petrpan-code/redwoodjs/redwood/packages/auth-providers/supabase/web/src | petrpan-code/redwoodjs/redwood/packages/auth-providers/supabase/web/src/__tests__/supabase.test.tsx | import type {
SupabaseClient,
User,
AuthResponse,
OAuthResponse,
SSOResponse,
SignInWithOAuthCredentials,
SignInWithIdTokenCredentials,
SignInWithPasswordlessCredentials,
SignInWithSSO,
SignInWithPasswordCredentials,
SignUpWithPasswordCredentials,
Session,
} from '@supabase/supabase-js'
import {... |
4,379 | 0 | petrpan-code/redwoodjs/redwood/packages/auth-providers/supertokens/api/src | petrpan-code/redwoodjs/redwood/packages/auth-providers/supertokens/api/src/__tests__/supertokens.test.ts | import type { APIGatewayProxyEvent, Context as LambdaContext } from 'aws-lambda'
import jwt from 'jsonwebtoken'
import { authDecoder } from '../decoder'
jest.mock('jsonwebtoken', () => {
return {
verify: jest.fn(),
decode: jest.fn(),
}
})
const req = {
event: {} as APIGatewayProxyEvent,
context: {} a... |
4,389 | 0 | petrpan-code/redwoodjs/redwood/packages/auth-providers/supertokens/setup/src | petrpan-code/redwoodjs/redwood/packages/auth-providers/supertokens/setup/src/__tests__/setup.test.ts | import { command, description, builder, handler } from '../setup'
// mock Telemetry for CLI commands so they don't try to spawn a process
jest.mock('@redwoodjs/telemetry', () => {
return {
errorTelemetry: () => jest.fn(),
timedTelemetry: () => jest.fn(),
}
})
test('standard exports', () => {
expect(comm... |
4,390 | 0 | petrpan-code/redwoodjs/redwood/packages/auth-providers/supertokens/setup/src | petrpan-code/redwoodjs/redwood/packages/auth-providers/supertokens/setup/src/__tests__/setupHandler.test.ts | // mock Telemetry for CLI commands so they don't try to spawn a process
jest.mock('@redwoodjs/telemetry', () => {
return {
errorTelemetry: () => jest.fn(),
timedTelemetry: () => jest.fn(),
}
})
jest.mock('@redwoodjs/cli-helpers', () => {
return {
getPaths: () => {
return {
web: {
... |
4,402 | 0 | petrpan-code/redwoodjs/redwood/packages/auth-providers/supertokens/web/src | petrpan-code/redwoodjs/redwood/packages/auth-providers/supertokens/web/src/__tests__/supertokens.test.tsx | import { renderHook, act } from '@testing-library/react'
import type { CurrentUser } from '@redwoodjs/auth'
import type {
SuperTokensUser,
SessionRecipe,
SuperTokensAuth,
} from '../supertokens'
import { createAuth } from '../supertokens'
const user: SuperTokensUser = {
userId: 'unique_user_id',
accessToke... |
4,426 | 0 | petrpan-code/redwoodjs/redwood/packages/auth/src | petrpan-code/redwoodjs/redwood/packages/auth/src/__tests__/AuthProvider.test.tsx | require('whatwg-fetch')
import React, { useEffect, useState } from 'react'
import {
render,
screen,
fireEvent,
waitFor,
configure,
} from '@testing-library/react'
import { renderHook, act } from '@testing-library/react'
import '@testing-library/jest-dom/extend-expect'
import { graphql } from 'msw'
import { ... |
4,432 | 0 | petrpan-code/redwoodjs/redwood/packages | petrpan-code/redwoodjs/redwood/packages/babel-config/dist.test.ts | import path from 'path'
const distPath = path.join(__dirname, 'dist')
describe('dist', () => {
it('exports', async () => {
const mod = await import(path.join(distPath, 'index.js'))
expect(mod).toMatchInlineSnapshot(`
{
"BABEL_PLUGIN_TRANSFORM_RUNTIME_OPTIONS": {
"corejs": {
... |
4,440 | 0 | petrpan-code/redwoodjs/redwood/packages/babel-config/src | petrpan-code/redwoodjs/redwood/packages/babel-config/src/__tests__/api.test.ts | import { vol } from 'memfs'
import { getPaths, ensurePosixPath } from '@redwoodjs/project-config'
import {
getApiSideBabelConfigPath,
getApiSideBabelPlugins,
getApiSideBabelPresets,
TARGETS_NODE,
} from '../api'
jest.mock('fs', () => require('memfs').fs)
const redwoodProjectPath = '/redwood-app'
process.env... |
4,441 | 0 | petrpan-code/redwoodjs/redwood/packages/babel-config/src | petrpan-code/redwoodjs/redwood/packages/babel-config/src/__tests__/common.test.ts | import { vol } from 'memfs'
import { ensurePosixPath } from '@redwoodjs/project-config'
import {
getCommonPlugins,
getPathsFromTypeScriptConfig,
parseTypeScriptConfigFiles,
} from '../common'
jest.mock('fs', () => require('memfs').fs)
const redwoodProjectPath = '/redwood-app'
process.env.RWJS_CWD = redwoodPro... |
4,442 | 0 | petrpan-code/redwoodjs/redwood/packages/babel-config/src | petrpan-code/redwoodjs/redwood/packages/babel-config/src/__tests__/prebuildApiFile.test.ts | import path from 'path'
import compat from 'core-js-compat'
import { getPaths, getConfig } from '@redwoodjs/project-config'
import {
BABEL_PLUGIN_TRANSFORM_RUNTIME_OPTIONS,
getApiSideBabelPlugins,
prebuildApiFile,
TARGETS_NODE,
} from '../api'
const RWJS_CWD = path.join(__dirname, '__fixtures__/redwood-app'... |
4,458 | 0 | petrpan-code/redwoodjs/redwood/packages/babel-config/src/plugins | petrpan-code/redwoodjs/redwood/packages/babel-config/src/plugins/__tests__/babel-plugin-redwood-cell.test.ts | import path from 'path'
import pluginTester from 'babel-plugin-tester'
import redwoodCellPlugin from '../babel-plugin-redwood-cell'
pluginTester({
plugin: redwoodCellPlugin,
pluginName: 'babel-plugin-redwood-cell',
fixtures: path.join(__dirname, '__fixtures__/cell'),
})
|
4,459 | 0 | petrpan-code/redwoodjs/redwood/packages/babel-config/src/plugins | petrpan-code/redwoodjs/redwood/packages/babel-config/src/plugins/__tests__/babel-plugin-redwood-directory-named-imports.test.ts | import * as babel from '@babel/core'
import namedDirectory from '../babel-plugin-redwood-directory-named-import'
const testCases = [
// Directory named imports
{
input:
'import { ImpModule } from "./__fixtures__/directory-named-imports/Module"',
output:
'import { ImpModule } from "./__fixtures... |
4,460 | 0 | petrpan-code/redwoodjs/redwood/packages/babel-config/src/plugins | petrpan-code/redwoodjs/redwood/packages/babel-config/src/plugins/__tests__/babel-plugin-redwood-import-dir.test.ts | import path from 'path'
import pluginTester from 'babel-plugin-tester'
import plugin from '../babel-plugin-redwood-import-dir'
describe('babel plugin redwood import dir', () => {
pluginTester({
plugin,
pluginName: 'babel-plugin-redwood-import-dir',
fixtures: path.join(__dirname, '__fixtures__/import-di... |
4,461 | 0 | petrpan-code/redwoodjs/redwood/packages/babel-config/src/plugins | petrpan-code/redwoodjs/redwood/packages/babel-config/src/plugins/__tests__/babel-plugin-redwood-mock-cell-data.test.ts | import path from 'path'
import pluginTester from 'babel-plugin-tester'
import plugin from '../babel-plugin-redwood-mock-cell-data'
describe('babel plugin redwood mock cell data', () => {
const __fixtures__ = path.resolve(__dirname, '../../../../../__fixtures__')
process.env.RWJS_CWD = path.join(__fixtures__, 'ex... |
4,462 | 0 | petrpan-code/redwoodjs/redwood/packages/babel-config/src/plugins | petrpan-code/redwoodjs/redwood/packages/babel-config/src/plugins/__tests__/babel-plugin-redwood-otel-wrapping.test.ts | import path from 'path'
import pluginTester from 'babel-plugin-tester'
import redwoodOtelWrappingPlugin from '../babel-plugin-redwood-otel-wrapping'
jest.mock('@redwoodjs/project-config', () => {
return {
getBaseDirFromFile: () => {
return ''
},
}
})
pluginTester({
plugin: redwoodOtelWrappingPlu... |
4,463 | 0 | petrpan-code/redwoodjs/redwood/packages/babel-config/src/plugins | petrpan-code/redwoodjs/redwood/packages/babel-config/src/plugins/__tests__/babel-plugin-redwood-remove-dev-fatal-error-page.test.ts | import path from 'path'
import pluginTester from 'babel-plugin-tester'
import plugin from '../babel-plugin-redwood-remove-dev-fatal-error-page'
describe('babel plugin redwood remove dev fatal error page', () => {
pluginTester({
plugin,
pluginName: 'babel-plugin-redwood-remove-dev-fatal-error-page',
fix... |
4,464 | 0 | petrpan-code/redwoodjs/redwood/packages/babel-config/src/plugins | petrpan-code/redwoodjs/redwood/packages/babel-config/src/plugins/__tests__/babel-plugin-redwood-routes-auto-loader.test.ts | import fs from 'fs'
import path from 'path'
import * as babel from '@babel/core'
import { getPaths } from '@redwoodjs/project-config'
import babelRoutesAutoLoader from '../babel-plugin-redwood-routes-auto-loader'
const transform = (filename: string) => {
const code = fs.readFileSync(filename, 'utf-8')
return ba... |
4,465 | 0 | petrpan-code/redwoodjs/redwood/packages/babel-config/src/plugins | petrpan-code/redwoodjs/redwood/packages/babel-config/src/plugins/__tests__/babel-plugin-redwood-src-alias.test.ts | import path from 'path'
import pluginTester from 'babel-plugin-tester'
import plugin from '../babel-plugin-redwood-src-alias'
const FIXTURE_PATH = path.resolve(
__dirname,
'../../../../../__fixtures__/empty-project'
)
describe('babel plugin redwood import dir - graphql function', () => {
pluginTester({
pl... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.