improving cleanup between tests in order to combat the frequent test failures seen recently

This commit is contained in:
El RIDO 2018-12-25 20:16:41 +01:00
parent 0ab06e34ec
commit 210870590c
No known key found for this signature in database
GPG key ID: 0F5C940A6BD81F92
3 changed files with 14 additions and 5 deletions

View file

@ -211,6 +211,10 @@ describe('Helper', function () {
describe('getCookie', function () { describe('getCookie', function () {
this.timeout(30000); this.timeout(30000);
after(function () {
cleanup();
});
jsc.property( jsc.property(
'returns the requested cookie', 'returns the requested cookie',
jsc.nearray(jsc.nearray(common.jscAlnumString())), jsc.nearray(jsc.nearray(common.jscAlnumString())),
@ -245,12 +249,12 @@ describe('Helper', function () {
jsc.nearray(common.jscA2zString()), jsc.nearray(common.jscA2zString()),
jsc.array(common.jscA2zString()), jsc.array(common.jscA2zString()),
jsc.array(common.jscQueryString()), jsc.array(common.jscQueryString()),
jsc.array(common.jscA2zString()), 'string',
function (schema, address, path, query, fragment) { function (schema, address, path, query, fragment) {
$.PrivateBin.Helper.reset(); $.PrivateBin.Helper.reset();
var path = path.join('') + (path.length > 0 ? '/' : ''), var path = path.join('') + (path.length > 0 ? '/' : ''),
expected = schema + '://' + address.join('') + '/' + path, expected = schema + '://' + address.join('') + '/' + path,
clean = jsdom('', {url: expected + '?' + query.join('') + '#' + fragment.join('')}), clean = jsdom('', {url: expected + '?' + query.join('') + '#' + fragment}),
result = $.PrivateBin.Helper.baseUri(); result = $.PrivateBin.Helper.baseUri();
clean(); clean();
return expected === result; return expected === result;

View file

@ -72,7 +72,7 @@ describe('Model', function () {
describe('getPasteId', function () { describe('getPasteId', function () {
this.timeout(30000); this.timeout(30000);
before(function () { beforeEach(function () {
$.PrivateBin.Model.reset(); $.PrivateBin.Model.reset();
cleanup(); cleanup();
}); });
@ -121,6 +121,11 @@ describe('Model', function () {
describe('getPasteKey', function () { describe('getPasteKey', function () {
this.timeout(30000); this.timeout(30000);
beforeEach(function () {
$.PrivateBin.Model.reset();
cleanup();
});
jsc.property( jsc.property(
'returns the fragment of the URL', 'returns the fragment of the URL',
jsc.nearray(common.jscA2zString()), jsc.nearray(common.jscA2zString()),
@ -183,7 +188,7 @@ describe('Model', function () {
}); });
describe('getTemplate', function () { describe('getTemplate', function () {
before(function () { beforeEach(function () {
$.PrivateBin.Model.reset(); $.PrivateBin.Model.reset();
cleanup(); cleanup();
}); });

View file

@ -6,7 +6,7 @@ describe('UiHelper', function () {
// for now we use a mock function to trigger the event // for now we use a mock function to trigger the event
describe('historyChange', function () { describe('historyChange', function () {
this.timeout(30000); this.timeout(30000);
before(function () { beforeEach(function () {
$.PrivateBin.Helper.reset(); $.PrivateBin.Helper.reset();
cleanup(); cleanup();
}); });