|
|
|
@ -1,22 +1,20 @@
|
|
|
|
|
'use strict';
|
|
|
|
|
var jsc = require('jsverify');
|
|
|
|
|
|
|
|
|
|
before(function () {
|
|
|
|
|
this.jsdom = require('jsdom-global')();
|
|
|
|
|
global.$ = global.jQuery = require('./jquery-3.1.1');
|
|
|
|
|
global.sjcl = require('./sjcl-1.0.6');
|
|
|
|
|
global.Base64 = require('./base64-2.1.9');
|
|
|
|
|
global.RawDeflate = require('./rawdeflate-0.5');
|
|
|
|
|
require('./rawinflate-0.3');
|
|
|
|
|
require('./privatebin');
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
after(function () {
|
|
|
|
|
this.jsdom();
|
|
|
|
|
})
|
|
|
|
|
var jsc = require('jsverify'),
|
|
|
|
|
jsdom = require('jsdom-global'),
|
|
|
|
|
cleanup = jsdom();
|
|
|
|
|
global.$ = global.jQuery = require('./jquery-3.1.1');
|
|
|
|
|
global.sjcl = require('./sjcl-1.0.6');
|
|
|
|
|
global.Base64 = require('./base64-2.1.9');
|
|
|
|
|
global.RawDeflate = require('./rawdeflate-0.5');
|
|
|
|
|
require('./rawinflate-0.3');
|
|
|
|
|
require('./privatebin');
|
|
|
|
|
|
|
|
|
|
describe('helper', function () {
|
|
|
|
|
describe('secondsToHuman', function () {
|
|
|
|
|
after(function () {
|
|
|
|
|
cleanup();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
jsc.property('returns an array with a number and a word', 'integer', function (number) {
|
|
|
|
|
var result = $.PrivateBin.helper.secondsToHuman(number);
|
|
|
|
|
return Array.isArray(result) &&
|
|
|
|
@ -56,5 +54,29 @@ describe('helper', function () {
|
|
|
|
|
return $.PrivateBin.helper.secondsToHuman(number)[1] === 'month';
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
describe('scriptLocation', function () {
|
|
|
|
|
after(function () {
|
|
|
|
|
cleanup();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
var a2zString = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'],
|
|
|
|
|
alnumString = a2zString.concat(['0','1','2','3','4','5','6','7','8','9']),
|
|
|
|
|
queryString = alnumString.concat(['+','%','&','.','*','-','_']);
|
|
|
|
|
jsc.property(
|
|
|
|
|
'returns the URL without query & fragment',
|
|
|
|
|
jsc.nearray(jsc.elements(a2zString)),
|
|
|
|
|
jsc.nearray(jsc.elements(a2zString)),
|
|
|
|
|
jsc.array(jsc.elements(queryString)),
|
|
|
|
|
'string',
|
|
|
|
|
function (schema, address, query, fragment) {
|
|
|
|
|
var expected = schema.join('') + '://' + address.join('') + '/',
|
|
|
|
|
clean = jsdom('', {url: expected + '?' + query.join('') + '#' + fragment}),
|
|
|
|
|
result = $.PrivateBin.helper.scriptLocation();
|
|
|
|
|
clean();
|
|
|
|
|
return expected === result;
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|