PHP 8.2.30
Preview: select-params.spec.js Size: 1.48 KB
/proc/thread-self/root/home/byroehnu/.trash/node_modules11/adminjs/lib/utils/flat/select-params.spec.js

import { expect } from 'chai';
import { selectParams } from './select-params.js';
describe('selectParams', () => {
  const params = {
    name: 'John',
    surname: 'Doe',
    age: 31,
    'meta.description': 'very ugly',
    'meta.title': 'cto',
    'meta.otherInfo': 'he stinks',
    metadetaksamosone: 'this is a steroid'
  };
  it('selects params for given property', () => {
    expect(selectParams(params, 'age')).to.deep.equal({
      age: 31
    });
  });
  it('select params for nested property', () => {
    expect(selectParams(params, 'meta')).to.deep.equal({
      'meta.description': 'very ugly',
      'meta.title': 'cto',
      'meta.otherInfo': 'he stinks'
    });
  });
  it('returns empty object when there is no match', () => {
    expect(selectParams(params, 'nothingIsThere')).to.deep.eq({});
  });
  it('returns multiple properties when they are given', () => {
    expect(selectParams(params, ['name', 'surname'])).to.deep.equal({
      name: 'John',
      surname: 'Doe'
    });
  });
  it('does not one property when is empty for multi-properties', () => {
    expect(selectParams(params, ['name', 'surname', 'meta', 'empty'])).to.deep.equal({
      name: 'John',
      surname: 'Doe',
      'meta.description': 'very ugly',
      'meta.title': 'cto',
      'meta.otherInfo': 'he stinks'
    });
  });
  it('does not throw an error when user passes undefined as a propertyPath', () => {
    expect(() => {
      selectParams(params, ['name', undefined]);
    }).not.to.throw();
  });
});

Directory Contents

Dirs: 0 × Files: 26

Name Size Perms Modified Actions
44 B lrw-r--r-- 2026-02-28 00:31:26
Edit Download
448 B lrw-r--r-- 2026-02-28 00:31:56
Edit Download
722 B lrw-r--r-- 2026-02-28 00:31:30
Edit Download
1.40 KB lrw-r--r-- 2026-02-28 00:31:30
Edit Download
906 B lrw-r--r-- 2026-02-28 00:31:32
Edit Download
2.74 KB lrw-r--r-- 2026-02-28 00:31:56
Edit Download
10 B lrw-r--r-- 2026-02-28 00:31:34
Edit Download
587 B lrw-r--r-- 2026-02-28 00:31:56
Edit Download
2.35 KB lrw-r--r-- 2026-02-28 00:31:34
Edit Download
2.75 KB lrw-r--r-- 2026-02-28 00:31:34
Edit Download
66 B lrw-r--r-- 2026-02-28 00:31:44
Edit Download
567 B lrw-r--r-- 2026-02-28 00:31:46
Edit Download
2.11 KB lrw-r--r-- 2026-02-28 00:31:46
Edit Download
10 B lrw-r--r-- 2026-02-28 00:31:48
Edit Download
730 B lrw-r--r-- 2026-02-28 00:31:56
Edit Download
701 B lrw-r--r-- 2026-02-28 00:31:48
Edit Download
814 B lrw-r--r-- 2026-02-28 00:31:48
Edit Download
1.21 KB lrw-r--r-- 2026-02-28 00:31:56
Edit Download
1.34 KB lrw-r--r-- 2026-02-28 00:31:48
Edit Download
2.47 KB lrw-r--r-- 2026-02-28 00:31:48
Edit Download
504 B lrw-r--r-- 2026-02-28 00:31:56
Edit Download
904 B lrw-r--r-- 2026-02-28 00:31:48
Edit Download
1.48 KB lrw-r--r-- 2026-02-28 00:31:48
Edit Download
639 B lrw-r--r-- 2026-02-28 00:31:56
Edit Download
1.85 KB lrw-r--r-- 2026-02-28 00:31:48
Edit Download
4.64 KB lrw-r--r-- 2026-02-28 00:31:48
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).