improve JS unit test readability & error reporting

This commit is contained in:
El RIDO 2025-10-06 14:52:08 +02:00
parent 06e95a0911
commit e853a934ea
No known key found for this signature in database
GPG key ID: 0F5C940A6BD81F92
5 changed files with 97 additions and 39 deletions

View file

@ -52,7 +52,11 @@ describe('TopNav', function () {
$('#qrcodelink').hasClass('hidden')
);
cleanup();
assert.ok(results.every(element => element));
const result = results.every(element => element);
if (!result) {
console.log(results);
}
assert.ok(result);
}
);
});
@ -113,7 +117,11 @@ describe('TopNav', function () {
$('#attach').hasClass('hidden')
);
cleanup();
assert.ok(results.every(element => element));
const result = results.every(element => element);
if (!result) {
console.log(results);
}
assert.ok(result);
}
);
});
@ -140,7 +148,11 @@ describe('TopNav', function () {
!$('#newbutton').hasClass('hidden')
);
cleanup();
assert.ok(results.every(element => element));
const result = results.every(element => element);
if (!result) {
console.log(results);
}
assert.ok(result);
}
);
});
@ -169,7 +181,11 @@ describe('TopNav', function () {
$('#clonebutton').hasClass('hidden')
);
cleanup();
assert.ok(results.every(element => element));
const result = results.every(element => element);
if (!result) {
console.log(results);
}
assert.ok(result);
}
);
});
@ -199,7 +215,11 @@ describe('TopNav', function () {
$('#rawtextbutton').hasClass('hidden')
);
cleanup();
assert.ok(results.every(element => element));
const result = results.every(element => element);
if (!result) {
console.log(results);
}
assert.ok(result);
}
);
});
@ -233,7 +253,11 @@ describe('TopNav', function () {
$('#filewrap').hasClass('hidden')
);
cleanup();
assert.ok(results.every(element => element));
const result = results.every(element => element);
if (!result) {
console.log(results);
}
assert.ok(result);
}
);
});
@ -267,7 +291,11 @@ describe('TopNav', function () {
!$('#customattachment').hasClass('hidden')
);
cleanup();
assert.ok(results.every(element => element));
const result = results.every(element => element);
if (!result) {
console.log(results);
}
assert.ok(result);
}
);
});
@ -318,7 +346,11 @@ describe('TopNav', function () {
);
*/
clean();
assert.ok(results.every(element => element));
const result = results.every(element => element);
if (!result) {
console.log(results);
}
assert.ok(result);
}
);
});
@ -364,7 +396,11 @@ describe('TopNav', function () {
!$.PrivateBin.TopNav.getOpenDiscussion()
);
cleanup();
assert.ok(results.every(element => element));
const result = results.every(element => element);
if (!result) {
console.log(results);
}
assert.ok(result);
}
);
@ -403,7 +439,11 @@ describe('TopNav', function () {
!$.PrivateBin.TopNav.getOpenDiscussion()
);
cleanup();
assert.ok(results.every(element => element));
const result = results.every(element => element);
if (!result) {
console.log(results);
}
assert.ok(result);
}
);
@ -443,7 +483,11 @@ describe('TopNav', function () {
$.PrivateBin.TopNav.getOpenDiscussion()
);
cleanup();
assert.ok(results.every(element => element));
const result = results.every(element => element);
if (!result) {
console.log(results);
}
assert.ok(result);
}
);
});
@ -462,7 +506,7 @@ describe('TopNav', function () {
'<option value="never">Never</option></select>'
);
$.PrivateBin.TopNav.init();
assert.ok($.PrivateBin.TopNav.getExpiration() === '1day');
assert.strictEqual($.PrivateBin.TopNav.getExpiration(), '1day');
cleanup();
}
);
@ -541,7 +585,11 @@ describe('TopNav', function () {
files[1].name === 'busy.gif'
);
cleanup();
assert.ok(results.every(element => element));
const result = results.every(element => element);
if (!result) {
console.log(results);
}
assert.ok(result);
}
);
});
@ -574,7 +622,11 @@ describe('TopNav', function () {
!$.PrivateBin.TopNav.getBurnAfterReading()
);
cleanup();
assert.ok(results.every(element => element));
const result = results.every(element => element);
if (!result) {
console.log(results);
}
assert.ok(result);
}
);
});
@ -607,7 +659,11 @@ describe('TopNav', function () {
!$.PrivateBin.TopNav.getOpenDiscussion()
);
cleanup();
assert.ok(results.every(element => element));
const result = results.every(element => element);
if (!result) {
console.log(results);
}
assert.ok(result);
}
);
});
@ -642,7 +698,11 @@ describe('TopNav', function () {
$.PrivateBin.TopNav.getPassword() === ''
);
cleanup();
return results.every(element => element);
const result = results.every(element => element);
if (!result) {
console.log(results);
}
return result;
}
);
});
@ -676,7 +736,11 @@ describe('TopNav', function () {
$.PrivateBin.TopNav.getCustomAttachment().hasClass('test')
);
cleanup();
assert.ok(results.every(element => element));
const result = results.every(element => element);
if (!result) {
console.log(results);
}
assert.ok(result);
}
);
});
@ -738,7 +802,7 @@ describe('TopNav', function () {
$.PrivateBin.Helper.reset();
$.PrivateBin.TopNav.init();
$('#rawtextbutton').click();
assert.equal($('pre').text(), sample);
assert.strictEqual($('pre').text(), sample);
clean();
}
);