feature: client: listeners: migrate to ESM

This commit is contained in:
coderiaser 2026-01-25 22:46:50 +02:00
parent 091f901789
commit f849b8423d
8 changed files with 26 additions and 40 deletions

View file

@ -1,23 +0,0 @@
'use strict';
const test = require('supertape');
const dir = '../../../client/listeners';
const getIndex = require(`${dir}/get-index`);
test('cloudcmd: client: listeners: getIndex: not found', (t) => {
const array = ['hello'];
t.equal(getIndex(array, 'world'), 0, 'should return index');
t.end();
});
test('cloudcmd: client: listeners: getIndex: found', (t) => {
const array = [
'hello',
'world',
];
t.equal(getIndex(array, 'world'), 1, 'should return index');
t.end();
});

View file

@ -1,56 +0,0 @@
'use strict';
const test = require('supertape');
const dir = '../../../client/listeners';
const getRange = require(`${dir}/get-range`);
test('cloudcmd: client: listeners: getRange: direct', (t) => {
const expected = [
'hello',
'world',
];
const files = [
...expected,
'how',
'come',
];
const result = getRange(0, 1, files);
t.deepEqual(result, expected, 'should return range');
t.end();
});
test('cloudcmd: client: listeners: getRange: reverse', (t) => {
const expected = [
'hello',
'world',
];
const files = [
...expected,
'how',
'come',
];
const result = getRange(1, 0, files);
t.deepEqual(result, expected, 'should return range');
t.end();
});
test('cloudcmd: client: listeners: getRange: one', (t) => {
const expected = ['hello'];
const files = [
...expected,
'how',
'come',
];
const result = getRange(0, 0, files);
t.deepEqual(result, expected, 'should return range');
t.end();
});