REDROOM
PHP 8.2.30
Path:
Logout
Edit File
Size: 2.12 KB
Close
//proc/thread-self/root/home/byroehnu/.trash/node_modules11/adminjs/src/frontend/components/routes/record-action.spec.tsx
Text
Base64
import React from 'react' import sinon from 'sinon' import { expect } from 'chai' import merge from 'lodash/merge.js' import i18n from 'i18next' import { render, RenderResult } from '@testing-library/react' import { Provider } from 'react-redux' import { Route, Routes } from 'react-router' import { AxiosResponse } from 'axios' import createStore, { ReduxState } from '../../store/store.js' import RecordAction from './record-action.js' import ApiClient from '../../utils/api-client.js' import { RecordJSON } from '../../interfaces/index.js' import TestContextProvider from '../spec/test-context-provider.js' import factory from '../spec/factory.js' import { TranslateFunctions, __testExports } from '../../../utils/translate-functions.factory.js' const defaultStore = { paths: {}, } const renderSubject = (store: Partial<ReduxState> = {}, location?: string): RenderResult => { const path = '/resources/:resourceId/records/:recordId/:actionName' const storeWithDefault = merge(defaultStore, store) const renderResult = render( <TestContextProvider location={location}> <Provider store={createStore(storeWithDefault)}> <Routes> <Route path={path} element={<RecordAction />} /> </Routes> </Provider> </TestContextProvider>, ) return renderResult } describe('<RecordAction />', function () { let record: RecordJSON beforeEach(async function () { record = await factory.build<RecordJSON>('RecordJSON.total') sinon.stub(__testExports, 'createFunctions').returns({ translateMessage: sinon.stub().returns('someMessage'), } as unknown as TranslateFunctions) sinon.stub(ApiClient, 'getBaseUrl').returns('/admin') sinon.stub(i18n, 'exists').returns(false) sinon.stub(ApiClient.prototype, 'recordAction').resolves({ data: { record } } as AxiosResponse) }) afterEach(function () { sinon.restore() }) it('renders 404 when there is no resource', async function () { const { findByTestId } = renderSubject({}, '/resources/someResource/records/1234/show') const errorBox = await findByTestId('NoResourceError') expect(errorBox).not.to.be.undefined }) })
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 1 × Files: 8
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
utils
DIR
-
drwxr-xr-x
2026-02-28 00:32:50
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
bulk-action.tsx
4.63 KB
lrw-r--r--
2026-02-28 00:32:46
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
dashboard.tsx
1.37 KB
lrw-r--r--
2026-02-28 00:32:46
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
index.ts
363 B
lrw-r--r--
2026-02-28 00:32:28
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
page.tsx
1.60 KB
lrw-r--r--
2026-02-28 00:32:48
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
record-action.spec.tsx
2.12 KB
lrw-r--r--
2026-02-28 00:32:48
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
record-action.tsx
5.85 KB
lrw-r--r--
2026-02-28 00:32:48
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
resource-action.tsx
3.47 KB
lrw-r--r--
2026-02-28 00:32:48
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
resource.tsx
3.26 KB
lrw-r--r--
2026-02-28 00:32:48
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Zip Selected
If ZipArchive is unavailable, a
.tar
will be created (no compression).