PHP 8.2.30
Preview: convert-param.spec.js Size: 824 B
/proc/thread-self/root/home/byroehnu/.trash/node_modules11/adminjs/lib/utils/param-converter/convert-param.spec.js

import { expect } from 'chai';
import { convertParam } from './convert-param.js';
describe('module:paramConverter.convertParam', () => {
  it('should convert numeric strings to Number', () => {
    expect(convertParam('123', 'number')).to.equal(123);
  });
  it('should convert bool strings to Boolean', () => {
    /*
      This will actually evaluate any string with length > 0 to true
      Ideally, additional validation should be added to convertParam
    */
    expect(convertParam('true', 'boolean')).to.equal(true);
  });
  it('should convert datetime strings to Date', () => {
    expect(convertParam('2021-11-08', 'datetime').getTime()).to.equal(new Date('2021-11-08').getTime());
  });
  it('should leave other values unchanged', () => {
    expect(convertParam(null, 'some other type')).to.equal(null);
  });
});

Directory Contents

Dirs: 0 × Files: 9

Name Size Perms Modified Actions
44 B lrw-r--r-- 2026-02-28 00:31:26
Edit Download
828 B lrw-r--r-- 2026-02-28 00:31:26
Edit Download
1.88 KB lrw-r--r-- 2026-02-28 00:31:26
Edit Download
386 B lrw-r--r-- 2026-02-28 00:31:26
Edit Download
824 B lrw-r--r-- 2026-02-28 00:31:26
Edit Download
44 B lrw-r--r-- 2026-02-28 00:31:44
Edit Download
313 B lrw-r--r-- 2026-02-28 00:31:48
Edit Download
1.35 KB lrw-r--r-- 2026-02-28 00:31:48
Edit Download
819 B lrw-r--r-- 2026-02-28 00:31:52
Edit Download

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