mirror of
https://git.cloudron.io/cloudron/gitea-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:
11
test/package-lock.json
generated
11
test/package-lock.json
generated
@@ -10,7 +10,6 @@
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"chromedriver": "^146.0.2",
|
||||
"expect.js": "^0.3.1",
|
||||
"mocha": "^11.7.5",
|
||||
"selenium-webdriver": "^4.41.0",
|
||||
"superagent": "^10.3.0"
|
||||
@@ -708,11 +707,6 @@
|
||||
"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": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-2.0.1.tgz",
|
||||
@@ -2571,11 +2565,6 @@
|
||||
"resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz",
|
||||
"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": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-2.0.1.tgz",
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"chromedriver": "^146.0.2",
|
||||
"expect.js": "^0.3.1",
|
||||
"mocha": "^11.7.5",
|
||||
"selenium-webdriver": "^4.41.0",
|
||||
"superagent": "^10.3.0"
|
||||
|
||||
14
test/test.js
14
test/test.js
@@ -8,7 +8,7 @@
|
||||
require('chromedriver');
|
||||
|
||||
const execSync = require('child_process').execSync,
|
||||
expect = require('expect.js'),
|
||||
assert = require('node:assert/strict'),
|
||||
fs = require('fs'),
|
||||
path = require('path'),
|
||||
superagent = require('superagent'),
|
||||
@@ -53,7 +53,7 @@ describe('Application life cycle test', function () {
|
||||
|
||||
const currentUrl = await browser.getCurrentUrl();
|
||||
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();
|
||||
fs.writeFileSync(`./screenshots/${new Date().getTime()}-${this.currentTest.title.replaceAll(' ', '_')}.png`, screenshotData, 'base64');
|
||||
@@ -62,7 +62,7 @@ describe('Application life cycle test', function () {
|
||||
function getAppInfo() {
|
||||
const inspect = JSON.parse(execSync('cloudron inspect'));
|
||||
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');
|
||||
}
|
||||
|
||||
async function waitForElement(elem) {
|
||||
@@ -91,7 +91,7 @@ describe('Application life cycle test', function () {
|
||||
const avatarSrc = await browser.findElement(By.xpath('//div[@id="profile-avatar"]/a/img')).getAttribute('src');
|
||||
|
||||
const response = await superagent.get(avatarSrc);
|
||||
expect(response.statusCode).to.equal(200);
|
||||
assert.strictEqual(response.statusCode, 200);
|
||||
}
|
||||
|
||||
async function login(username, password) {
|
||||
@@ -186,7 +186,7 @@ describe('Application life cycle test', function () {
|
||||
}
|
||||
|
||||
function fileExists() {
|
||||
expect(fs.existsSync(repodir + '/newfile')).to.be(true);
|
||||
assert.strictEqual(fs.existsSync(repodir + '/newfile'), true);
|
||||
}
|
||||
|
||||
async function sendMail() {
|
||||
@@ -232,7 +232,7 @@ describe('Application life cycle test', function () {
|
||||
it('can login', loginOIDC.bind(null, username, password));
|
||||
it('can get avatar', checkAvatar);
|
||||
it('can clone the url', cloneRepo);
|
||||
it('file exists in repo', function () { expect(fs.existsSync(repodir + '/newfile')).to.be(true); });
|
||||
it('file exists in repo', function () { assert.strictEqual(fs.existsSync(repodir + '/newfile'), true); });
|
||||
|
||||
it('move to different location', async function () {
|
||||
//browser.manage().deleteAllCookies(); // commented because of error "'Network.deleteCookie' wasn't found"
|
||||
@@ -246,7 +246,7 @@ describe('Application life cycle test', function () {
|
||||
it('can login', loginOIDC.bind(null, username, password));
|
||||
it('can get avatar', checkAvatar);
|
||||
it('can clone the url', cloneRepo);
|
||||
it('file exists in repo', function () { expect(fs.existsSync(repodir + '/newfile')).to.be(true); });
|
||||
it('file exists in repo', function () { assert.strictEqual(fs.existsSync(repodir + '/newfile'), true); });
|
||||
|
||||
it('uninstall app', async function () {
|
||||
// ensure we don't hit NXDOMAIN in the mean time
|
||||
|
||||
Reference in New Issue
Block a user