1
0
mirror of https://git.cloudron.io/cloudron/freshrss-app synced 2026-04-24 03:34:59 +00:00

Replace expect.js with node:assert/strict

expect.js is unmaintained and unnecessary — Node's built-in assert
module covers all our assertion patterns. This also removes expect.js
from package.json dependencies.

Made-with: Cursor
This commit is contained in:
Girish Ramakrishnan
2026-04-15 15:37:12 +02:00
parent e425f4459a
commit 6581c225c0
3 changed files with 7 additions and 19 deletions

11
test/package-lock.json generated
View File

@@ -10,7 +10,6 @@
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"chromedriver": "^144.0.0", "chromedriver": "^144.0.0",
"expect.js": "^0.3.1",
"mocha": "^11.7.5", "mocha": "^11.7.5",
"selenium-webdriver": "^4.40.0", "selenium-webdriver": "^4.40.0",
"superagent": "^10.3.0" "superagent": "^10.3.0"
@@ -671,11 +670,6 @@
"node": ">=0.10.0" "node": ">=0.10.0"
} }
}, },
"node_modules/expect.js": {
"version": "0.3.1",
"resolved": "https://registry.npmjs.org/expect.js/-/expect.js-0.3.1.tgz",
"integrity": "sha1-sKWaDS7/VDdUTr8M6qYBWEHQm1s="
},
"node_modules/extract-zip": { "node_modules/extract-zip": {
"version": "2.0.1", "version": "2.0.1",
"resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-2.0.1.tgz", "resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-2.0.1.tgz",
@@ -2802,11 +2796,6 @@
"resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz",
"integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==" "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g=="
}, },
"expect.js": {
"version": "0.3.1",
"resolved": "https://registry.npmjs.org/expect.js/-/expect.js-0.3.1.tgz",
"integrity": "sha1-sKWaDS7/VDdUTr8M6qYBWEHQm1s="
},
"extract-zip": { "extract-zip": {
"version": "2.0.1", "version": "2.0.1",
"resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-2.0.1.tgz", "resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-2.0.1.tgz",

View File

@@ -10,7 +10,6 @@
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"chromedriver": "^144.0.0", "chromedriver": "^144.0.0",
"expect.js": "^0.3.1",
"mocha": "^11.7.5", "mocha": "^11.7.5",
"selenium-webdriver": "^4.40.0", "selenium-webdriver": "^4.40.0",
"superagent": "^10.3.0" "superagent": "^10.3.0"

View File

@@ -7,7 +7,7 @@
require('chromedriver'); require('chromedriver');
const execSync = require('child_process').execSync, const execSync = require('child_process').execSync,
expect = require('expect.js'), assert = require('node:assert/strict'),
fs = require('fs'), fs = require('fs'),
path = require('path'), path = require('path'),
superagent = require('superagent'), superagent = require('superagent'),
@@ -50,7 +50,7 @@ describe('Application life cycle test', function () {
const currentUrl = await browser.getCurrentUrl(); const currentUrl = await browser.getCurrentUrl();
if (!currentUrl.includes(app.domain)) return; if (!currentUrl.includes(app.domain)) return;
expect(this.currentTest.title).to.be.a('string'); assert.strictEqual(typeof this.currentTest.title, 'string');
const screenshotData = await browser.takeScreenshot(); const screenshotData = await browser.takeScreenshot();
fs.writeFileSync(`./screenshots/${new Date().getTime()}-${this.currentTest.title.replaceAll(' ', '_')}.png`, screenshotData, 'base64'); fs.writeFileSync(`./screenshots/${new Date().getTime()}-${this.currentTest.title.replaceAll(' ', '_')}.png`, screenshotData, 'base64');
@@ -59,7 +59,7 @@ describe('Application life cycle test', function () {
function getAppInfo() { function getAppInfo() {
var inspect = JSON.parse(execSync('cloudron inspect')); var inspect = JSON.parse(execSync('cloudron inspect'));
app = inspect.apps.filter(function (a) { return a.location.indexOf(LOCATION) === 0; })[0]; app = inspect.apps.filter(function (a) { return a.location.indexOf(LOCATION) === 0; })[0];
expect(app).to.be.an('object'); assert.ok(app && typeof app === 'object');
} }
function baseUrl() { function baseUrl() {
@@ -152,8 +152,8 @@ describe('Application life cycle test', function () {
const response = await superagent.get(`${baseUrl()}/ext.php?f=xExtension-StickyFeeds/static/script.js&t=js`) const response = await superagent.get(`${baseUrl()}/ext.php?f=xExtension-StickyFeeds/static/script.js&t=js`)
.buffer(true) .buffer(true)
.ok(() => true); .ok(() => true);
expect(response.statusCode).to.be(200); assert.strictEqual(response.statusCode, 200);
expect(response.text).to.contain('sticky_feeds'); // relies on the buffer flag above assert.ok(response.text.includes('sticky_feeds')); // relies on the buffer flag above
} }
xit('build app', function () { execSync('cloudron build', EXEC_ARGS); }); xit('build app', function () { execSync('cloudron build', EXEC_ARGS); });
@@ -204,7 +204,7 @@ describe('Application life cycle test', function () {
execSync('cloudron configure --location ' + LOCATION + '2 --app ' + app.id, EXEC_ARGS); execSync('cloudron configure --location ' + LOCATION + '2 --app ' + app.id, EXEC_ARGS);
var inspect = JSON.parse(execSync('cloudron inspect')); var inspect = JSON.parse(execSync('cloudron inspect'));
app = inspect.apps.filter(function (a) { return a.location === LOCATION + '2'; })[0]; app = inspect.apps.filter(function (a) { return a.location === LOCATION + '2'; })[0];
expect(app).to.be.an('object'); assert.ok(app && typeof app === 'object');
}); });
it('can login OIDC', loginOIDC.bind(null, USERNAME, PASSWORD)); it('can login OIDC', loginOIDC.bind(null, USERNAME, PASSWORD));
@@ -226,7 +226,7 @@ describe('Application life cycle test', function () {
execSync('cloudron update --app ' + app.id, EXEC_ARGS); execSync('cloudron update --app ' + app.id, EXEC_ARGS);
var inspect = JSON.parse(execSync('cloudron inspect')); var inspect = JSON.parse(execSync('cloudron inspect'));
app = inspect.apps.filter(function (a) { return a.location === LOCATION; })[0]; app = inspect.apps.filter(function (a) { return a.location === LOCATION; })[0];
expect(app).to.be.an('object'); assert.ok(app && typeof app === 'object');
}); });
it('subscription exists', subscriptionExists); it('subscription exists', subscriptionExists);