REDROOM
PHP 8.2.30
Path:
Logout
Edit File
Size: 3.46 KB
Close
//proc/thread-self/root/home/byroehnu/.trash/node_modules11/adminjs/lib/backend/adapters/resource/base-resource.spec.js
Text
Base64
import chai, { expect } from 'chai'; import sinon from 'sinon'; import chaiAsPromised from 'chai-as-promised'; import BaseResource from './base-resource.js'; import NotImplementedError from '../../utils/errors/not-implemented-error.js'; import BaseRecord from '../record/base-record.js'; import AdminJS from '../../../adminjs.js'; import ResourceDecorator from '../../decorators/resource/resource-decorator.js'; chai.use(chaiAsPromised); describe('BaseResource', function () { let resource; beforeEach(function () { resource = new BaseResource({}); }); afterEach(function () { sinon.restore(); }); describe('.isAdapterFor', function () { it('throws NotImplementedError', async function () { expect(() => BaseResource.isAdapterFor({})).to.throw(NotImplementedError); }); }); describe('#databaseName', function () { it('throws NotImplementedError', async function () { expect(() => resource.databaseName()).to.throw(NotImplementedError); }); }); describe('#databaseType', function () { it('returns "database" by default', async function () { expect(resource.databaseType()).to.eq('other'); }); }); describe('#id', function () { it('throws NotImplementedError', async function () { expect(() => resource.id()).to.throw(NotImplementedError); }); }); describe('#properties', function () { it('throws NotImplementedError', async function () { expect(() => resource.properties()).to.throw(NotImplementedError); }); }); describe('#property', function () { it('throws NotImplementedError', async function () { expect(() => resource.property('someProperty')).to.throw(NotImplementedError); }); }); describe('#count', function () { it('throws NotImplementedError', async function () { expect(resource.count({})).to.be.rejectedWith(NotImplementedError); }); }); describe('#find', function () { it('throws NotImplementedError', async function () { expect(resource.find({}, {})).to.be.rejectedWith(NotImplementedError); }); }); describe('#findOne', function () { it('throws NotImplementedError', async function () { expect(resource.findOne('someId')).to.be.rejectedWith(NotImplementedError); }); }); describe('#build', function () { it('returns new BaseRecord', async function () { const params = { param: 'value' }; expect(resource.build(params)).to.be.instanceOf(BaseRecord); }); }); describe('#create', function () { it('throws NotImplementedError', async function () { expect(resource.create({})).to.be.rejectedWith(NotImplementedError); }); }); describe('#update', function () { it('throws NotImplementedError', async function () { expect(resource.update('id', {})).to.be.rejectedWith(NotImplementedError); }); }); describe('#delete', function () { it('throws NotImplementedError', async function () { expect(resource.delete('id')).to.be.rejectedWith(NotImplementedError); }); }); describe('#decorate', function () { it('returns new Decorator when resource has been decorated', function () { sinon.stub(resource, 'properties').returns([]); resource.assignDecorator(new AdminJS(), {}); expect(resource.decorate()).to.be.instanceOf(ResourceDecorator); }); it('throws error when resource has not been decorated', function () { expect(() => resource.decorate()).to.throw('resource does not have any assigned decorator yet'); }); }); });
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 0 × Files: 4
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
base-resource.js
7.89 KB
lrw-r--r--
2026-02-28 00:31:20
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
base-resource.spec.js
3.46 KB
lrw-r--r--
2026-02-28 00:31:22
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
index.js
108 B
lrw-r--r--
2026-02-28 00:31:40
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
supported-databases.type.js
10 B
lrw-r--r--
2026-02-28 00:31:50
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).