Some checks failed
CI / go (push) Waiting to run
CI / docker (push) Waiting to run
CI / lint-go (push) Waiting to run
CI / lint-docs (push) Waiting to run
CI / check-paperclip (push) Waiting to run
Deploy static site / Deploy to GitHub Pages (push) Has been cancelled
Deploy static site / Deploy via Docker to hatch.surf (push) Has been cancelled
Resolved conflicts by taking GitHub versions for: - .dockerignore, .gitignore, Dockerfile, README.md, docker-compose.yml Kept deploy.sh updated to: - Pull from GitHub (primary source) - Push to Gitea (push-mirror) - Build from site/ directory (GitHub structure) Co-Authored-By: Paperclip <noreply@paperclip.ing>
50 lines
1.6 KiB
JavaScript
50 lines
1.6 KiB
JavaScript
'use strict';
|
|
|
|
var path = require('path');
|
|
var test = require('tape');
|
|
var mockProperty = require('mock-property');
|
|
|
|
var homedirPath = require.resolve('../lib/homedir');
|
|
var asyncPath = require.resolve('../async');
|
|
var libAsyncPath = require.resolve('../lib/async');
|
|
var syncPath = require.resolve('../sync');
|
|
var libSyncPath = require.resolve('../lib/sync');
|
|
|
|
function mockNullHomedir(t) {
|
|
t.teardown(mockProperty(require.cache, homedirPath, {
|
|
value: { id: homedirPath, filename: homedirPath, loaded: true, exports: function () { return null; } }
|
|
}));
|
|
}
|
|
|
|
test('async: null homedir does not throw', function (t) {
|
|
t.plan(2);
|
|
|
|
mockNullHomedir(t);
|
|
t.teardown(mockProperty(require.cache, asyncPath, { 'delete': true }));
|
|
t.teardown(mockProperty(require.cache, libAsyncPath, { 'delete': true }));
|
|
|
|
var resolve = require('../lib/async');
|
|
|
|
var dir = path.join(__dirname, 'resolver');
|
|
|
|
resolve('./baz', { basedir: dir }, function (err, res) {
|
|
t.error(err, 'no error');
|
|
t.equal(res, path.join(dir, 'baz', 'quux.js'), 'resolves correctly with null homedir');
|
|
});
|
|
});
|
|
|
|
test('sync: null homedir does not throw', function (t) {
|
|
mockNullHomedir(t);
|
|
t.teardown(mockProperty(require.cache, syncPath, { 'delete': true }));
|
|
t.teardown(mockProperty(require.cache, libSyncPath, { 'delete': true }));
|
|
|
|
var resolveSync = require('../lib/sync');
|
|
|
|
var dir = path.join(__dirname, 'resolver');
|
|
|
|
var res = resolveSync('./baz', { basedir: dir });
|
|
t.equal(res, path.join(dir, 'baz', 'quux.js'), 'resolves correctly with null homedir');
|
|
|
|
t.end();
|
|
});
|