REDROOM
PHP 8.2.30
Path:
Logout
Edit File
Size: 2.02 KB
Close
/proc/thread-self/root/home/byroehnu/.trash/node_modules11/adminjs/lib/frontend/components/routes/record-action.spec.js
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 } from '@testing-library/react'; import { Provider } from 'react-redux'; import { Route, Routes } from 'react-router'; import createStore from '../../store/store.js'; import RecordAction from './record-action.js'; import ApiClient from '../../utils/api-client.js'; import TestContextProvider from '../spec/test-context-provider.js'; import factory from '../spec/factory.js'; import { __testExports } from '../../../utils/translate-functions.factory.js'; const defaultStore = { paths: {} }; const renderSubject = (store = {}, location) => { const path = '/resources/:resourceId/records/:recordId/:actionName'; const storeWithDefault = merge(defaultStore, store); const renderResult = render( /*#__PURE__*/React.createElement(TestContextProvider, { location: location }, /*#__PURE__*/React.createElement(Provider, { store: createStore(storeWithDefault) }, /*#__PURE__*/React.createElement(Routes, null, /*#__PURE__*/React.createElement(Route, { path: path, element: /*#__PURE__*/React.createElement(RecordAction, null) }))))); return renderResult; }; describe('<RecordAction />', function () { let record; beforeEach(async function () { record = await factory.build('RecordJSON.total'); sinon.stub(__testExports, 'createFunctions').returns({ translateMessage: sinon.stub().returns('someMessage') }); sinon.stub(ApiClient, 'getBaseUrl').returns('/admin'); sinon.stub(i18n, 'exists').returns(false); sinon.stub(ApiClient.prototype, 'recordAction').resolves({ data: { record } }); }); 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:31:52
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
bulk-action.js
4.65 KB
lrw-r--r--
2026-02-28 00:31:24
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
dashboard.js
1.05 KB
lrw-r--r--
2026-02-28 00:31:26
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
index.js
368 B
lrw-r--r--
2026-02-28 00:31:44
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
page.js
1.71 KB
lrw-r--r--
2026-02-28 00:31:48
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
record-action.js
5.83 KB
lrw-r--r--
2026-02-28 00:31:48
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
record-action.spec.js
2.02 KB
lrw-r--r--
2026-02-28 00:31:48
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
resource-action.js
3.58 KB
lrw-r--r--
2026-02-28 00:31:48
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
resource.js
3.11 KB
lrw-r--r--
2026-02-28 00:31: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).