25 lines
937 B
JavaScript
25 lines
937 B
JavaScript
import assert from 'node:assert/strict';
|
|
import fs from 'node:fs/promises';
|
|
import path from 'node:path';
|
|
import test from 'node:test';
|
|
|
|
const root = path.resolve(import.meta.dirname, '..');
|
|
|
|
async function read(relativePath) {
|
|
return fs.readFile(path.join(root, relativePath), 'utf8');
|
|
}
|
|
|
|
test('default server socket is the Atlas loopback endpoint', async () => {
|
|
const configSource = await read('src/config.js');
|
|
const envExample = await read('.env.example');
|
|
const serverSource = await read('server.js');
|
|
|
|
assert.match(configSource, /process\.env\.HOST \|\| '127\.0\.0\.1'/);
|
|
assert.match(configSource, /process\.env\.PORT \|\| '47145'/);
|
|
assert.match(configSource, /process\.env\.INSTANCE_NAME \|\| 'Atlas'/);
|
|
assert.match(envExample, /^HOST=127\.0\.0\.1$/m);
|
|
assert.match(envExample, /^PORT=47145$/m);
|
|
assert.match(envExample, /^INSTANCE_NAME=Atlas$/m);
|
|
assert.match(serverSource, /config\.instanceName/);
|
|
});
|