migrate tests to node:test
This commit is contained in:
@@ -1,9 +1,8 @@
|
||||
/* global it:false */
|
||||
import { describe, it } from 'node:test';
|
||||
|
||||
import DataLayout from '../datalayout.js';
|
||||
import expect from 'expect.js';
|
||||
import assert from 'node:assert/strict';
|
||||
|
||||
/* global describe:false */
|
||||
|
||||
describe('DataLayout', function () {
|
||||
describe('no dirMap', function () {
|
||||
@@ -11,28 +10,28 @@ describe('DataLayout', function () {
|
||||
const dataLayout = new DataLayout(BOX_DATA_DIR, []);
|
||||
|
||||
it('localRoot', function () {
|
||||
expect(dataLayout.localRoot()).to.be(BOX_DATA_DIR);
|
||||
assert.equal(dataLayout.localRoot(), BOX_DATA_DIR);
|
||||
});
|
||||
|
||||
it('getBasename', function () {
|
||||
expect(dataLayout.getBasename()).to.be('box');
|
||||
assert.equal(dataLayout.getBasename(), 'box');
|
||||
});
|
||||
|
||||
it('localPaths', function () {
|
||||
expect(dataLayout.localPaths()).to.eql([ BOX_DATA_DIR ]);
|
||||
assert.deepEqual(dataLayout.localPaths(), [ BOX_DATA_DIR ]);
|
||||
});
|
||||
|
||||
it('toLocalPath', function () {
|
||||
expect(dataLayout.toLocalPath('./s1')).to.be(`${BOX_DATA_DIR}/s1`);
|
||||
expect(dataLayout.toLocalPath('./s1/')).to.be(`${BOX_DATA_DIR}/s1/`);
|
||||
expect(dataLayout.toLocalPath('./s1/s2')).to.be(`${BOX_DATA_DIR}/s1/s2`);
|
||||
assert.equal(dataLayout.toLocalPath('./s1'), `${BOX_DATA_DIR}/s1`);
|
||||
assert.equal(dataLayout.toLocalPath('./s1/'), `${BOX_DATA_DIR}/s1/`);
|
||||
assert.equal(dataLayout.toLocalPath('./s1/s2'), `${BOX_DATA_DIR}/s1/s2`);
|
||||
});
|
||||
|
||||
it('toRemotePath', function () {
|
||||
expect(dataLayout.toRemotePath(`${BOX_DATA_DIR}`)).to.be('./');
|
||||
expect(dataLayout.toRemotePath(`${BOX_DATA_DIR}/s1`)).to.be('./s1');
|
||||
expect(dataLayout.toRemotePath(`${BOX_DATA_DIR}/s1/`)).to.be('./s1/');
|
||||
expect(dataLayout.toRemotePath(`${BOX_DATA_DIR}/s1/s2`)).to.be('./s1/s2');
|
||||
assert.equal(dataLayout.toRemotePath(`${BOX_DATA_DIR}`), './');
|
||||
assert.equal(dataLayout.toRemotePath(`${BOX_DATA_DIR}/s1`), './s1');
|
||||
assert.equal(dataLayout.toRemotePath(`${BOX_DATA_DIR}/s1/`), './s1/');
|
||||
assert.equal(dataLayout.toRemotePath(`${BOX_DATA_DIR}/s1/s2`), './s1/s2');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -42,41 +41,41 @@ describe('DataLayout', function () {
|
||||
const dataLayout = new DataLayout(APP_DATA_DIR, [ { localDir: EXT_DIR, remoteDir: 'data' }]);
|
||||
|
||||
it('localRoot', function () {
|
||||
expect(dataLayout.localRoot()).to.be(APP_DATA_DIR);
|
||||
assert.equal(dataLayout.localRoot(), APP_DATA_DIR);
|
||||
});
|
||||
|
||||
it('getBasename', function () {
|
||||
expect(dataLayout.getBasename()).to.be('appid');
|
||||
assert.equal(dataLayout.getBasename(), 'appid');
|
||||
});
|
||||
|
||||
it('localPaths', function () {
|
||||
expect(dataLayout.localPaths()).to.eql([ APP_DATA_DIR, '/srv/hsb' ]);
|
||||
assert.deepEqual(dataLayout.localPaths(), [ APP_DATA_DIR, '/srv/hsb' ]);
|
||||
});
|
||||
|
||||
it('toLocalPath - root', function () {
|
||||
expect(dataLayout.toLocalPath('./s1')).to.be(`${APP_DATA_DIR}/s1`);
|
||||
expect(dataLayout.toLocalPath('./s1/')).to.be(`${APP_DATA_DIR}/s1/`);
|
||||
expect(dataLayout.toLocalPath('./s1/s2')).to.be(`${APP_DATA_DIR}/s1/s2`);
|
||||
assert.equal(dataLayout.toLocalPath('./s1'), `${APP_DATA_DIR}/s1`);
|
||||
assert.equal(dataLayout.toLocalPath('./s1/'), `${APP_DATA_DIR}/s1/`);
|
||||
assert.equal(dataLayout.toLocalPath('./s1/s2'), `${APP_DATA_DIR}/s1/s2`);
|
||||
});
|
||||
|
||||
it('toLocalPath - extdir', function () {
|
||||
expect(dataLayout.toLocalPath('./data/s1')).to.be(`${EXT_DIR}/s1`);
|
||||
expect(dataLayout.toLocalPath('./data/s1/')).to.be(`${EXT_DIR}/s1/`);
|
||||
expect(dataLayout.toLocalPath('./data/s1/s2')).to.be(`${EXT_DIR}/s1/s2`);
|
||||
assert.equal(dataLayout.toLocalPath('./data/s1'), `${EXT_DIR}/s1`);
|
||||
assert.equal(dataLayout.toLocalPath('./data/s1/'), `${EXT_DIR}/s1/`);
|
||||
assert.equal(dataLayout.toLocalPath('./data/s1/s2'), `${EXT_DIR}/s1/s2`);
|
||||
});
|
||||
|
||||
it('toRemotePath - root', function () {
|
||||
expect(dataLayout.toRemotePath(`${APP_DATA_DIR}`)).to.be('./');
|
||||
expect(dataLayout.toRemotePath(`${APP_DATA_DIR}/s1`)).to.be('./s1');
|
||||
expect(dataLayout.toRemotePath(`${APP_DATA_DIR}/s1/`)).to.be('./s1/');
|
||||
expect(dataLayout.toRemotePath(`${APP_DATA_DIR}/s1/s2`)).to.be('./s1/s2');
|
||||
assert.equal(dataLayout.toRemotePath(`${APP_DATA_DIR}`), './');
|
||||
assert.equal(dataLayout.toRemotePath(`${APP_DATA_DIR}/s1`), './s1');
|
||||
assert.equal(dataLayout.toRemotePath(`${APP_DATA_DIR}/s1/`), './s1/');
|
||||
assert.equal(dataLayout.toRemotePath(`${APP_DATA_DIR}/s1/s2`), './s1/s2');
|
||||
});
|
||||
|
||||
it('toRemotePath - extdir', function () {
|
||||
expect(dataLayout.toRemotePath(`${EXT_DIR}`)).to.be('./data/');
|
||||
expect(dataLayout.toRemotePath(`${EXT_DIR}/s1`)).to.be('./data/s1');
|
||||
expect(dataLayout.toRemotePath(`${EXT_DIR}/s1/`)).to.be('./data/s1/');
|
||||
expect(dataLayout.toRemotePath(`${EXT_DIR}/s1/s2`)).to.be('./data/s1/s2');
|
||||
assert.equal(dataLayout.toRemotePath(`${EXT_DIR}`), './data/');
|
||||
assert.equal(dataLayout.toRemotePath(`${EXT_DIR}/s1`), './data/s1');
|
||||
assert.equal(dataLayout.toRemotePath(`${EXT_DIR}/s1/`), './data/s1/');
|
||||
assert.equal(dataLayout.toRemotePath(`${EXT_DIR}/s1/s2`), './data/s1/s2');
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user