38 lines
1.4 KiB
JavaScript
38 lines
1.4 KiB
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('current local jQuery and jQuery UI distributions are present', async () => {
|
|
const jquery = await read('public/vendor/jquery/jquery-4.0.0.min.js');
|
|
const jqueryUi = await read('public/vendor/jquery-ui/jquery-ui-1.14.2.min.js');
|
|
const jqueryUiCss = await read('public/vendor/jquery-ui/jquery-ui-1.14.2.min.css');
|
|
|
|
assert.match(jquery, /jQuery v4\.0\.0/);
|
|
assert.match(jqueryUi, /jQuery UI - v1\.14\.2/);
|
|
assert.match(jqueryUiCss, /jQuery UI - v1\.14\.2/);
|
|
});
|
|
|
|
test('jQuery UI base theme image resources are vendored', async () => {
|
|
const images = await fs.readdir(path.join(root, 'public/vendor/jquery-ui/images'));
|
|
assert.ok(images.includes('ui-icons_444444_256x240.png'));
|
|
assert.ok(images.includes('ui-icons_ffffff_256x240.png'));
|
|
});
|
|
|
|
test('client no longer references jQuery Mobile', async () => {
|
|
const files = [
|
|
'public/index.html',
|
|
'public/js/bootstrap-loader.js',
|
|
'public/js/app.js',
|
|
'public/css/app.css'
|
|
];
|
|
const content = (await Promise.all(files.map(read))).join('\n');
|
|
assert.doesNotMatch(content, /jquery[.-]?mobile|jQuery Mobile|\$\.mobile|data-role=/i);
|
|
});
|