Skip to content

Commit

Permalink
DTM-15545: update dependencies.
Browse files Browse the repository at this point in the history
Make build scripts more clear.

Enforce test & lint during commit.
  • Loading branch information
Brent Hosie committed Jan 15, 2021
1 parent 53b541a commit 2064e8b
Show file tree
Hide file tree
Showing 9 changed files with 15,753 additions and 1,877 deletions.
1 change: 1 addition & 0 deletions .npmrc
@@ -0,0 +1 @@
engine-strict=true
6 changes: 3 additions & 3 deletions coreModulePackages/cookie/test.js
Expand Up @@ -13,14 +13,14 @@

var cookie = require('./index');

describe('cookie', function() {
it('exposes get, set, and remove', function() {
describe('cookie', function () {
it('exposes get, set, and remove', function () {
expect(cookie.get).toEqual(jasmine.any(Function));
expect(cookie.set).toEqual(jasmine.any(Function));
expect(cookie.remove).toEqual(jasmine.any(Function));
});

it('does not expose other methods supported by the underlying implementation', function() {
it('does not expose other methods supported by the underlying implementation', function () {
expect(Object.keys(cookie).length).toBe(3);
});
});
11 changes: 5 additions & 6 deletions coreModulePackages/loadScript/index.js
Expand Up @@ -13,19 +13,19 @@

var Promise = require('@adobe/reactor-promise');

var getPromise = function(url, script) {
return new Promise(function(resolve, reject) {
script.onload = function() {
var getPromise = function (url, script) {
return new Promise(function (resolve, reject) {
script.onload = function () {
resolve(script);
};

script.onerror = function() {
script.onerror = function () {
reject(new Error('Failed to load script ' + url));
};
});
};

module.exports = function(url) {
module.exports = function (url) {
var script = document.createElement('script');
script.src = url;
script.async = true;
Expand All @@ -35,4 +35,3 @@ module.exports = function(url) {
document.getElementsByTagName('head')[0].appendChild(script);
return promise;
};

14 changes: 8 additions & 6 deletions coreModulePackages/loadScript/test.js
Expand Up @@ -13,22 +13,24 @@

var loadScript = require('./index');

describe('loadScript', function() {
it('returns a promise', function() {
describe('loadScript', function () {
it('returns a promise', function () {
var promise = loadScript('/base/coreModulePackages/loadScript/empty.js');
expect(promise.then).toBeDefined();
expect(promise.catch).toBeDefined();
});

it('should fulfill with script element when the script is loaded', function(done) {
loadScript('/base/coreModulePackages/loadScript/empty.js').then(function(script) {
it('should fulfill with script element when the script is loaded', function (done) {
loadScript('/base/coreModulePackages/loadScript/empty.js').then(function (
script
) {
expect(script).toEqual(jasmine.any(HTMLScriptElement));
done();
});
});

it('should reject with error when script fails to load', function(done) {
loadScript('nonexistent.js').catch(function(error) {
it('should reject with error when script fails to load', function (done) {
loadScript('nonexistent.js').catch(function (error) {
expect(error).toEqual(jasmine.any(Error));
expect(error.message).toBe('Failed to load script nonexistent.js');
done();
Expand Down
4 changes: 2 additions & 2 deletions coreModulePackages/query-string/index.js
Expand Up @@ -18,7 +18,7 @@ var querystring = require('querystring');
// having to worry about breaking extensions. If extensions demand additional functionality, we
// can make adjustments as needed.
module.exports = {
parse: function(string) {
parse: function (string) {
//
if (typeof string === 'string') {
// Remove leading ?, #, & for some leniency so you can pass in location.search or
Expand All @@ -27,7 +27,7 @@ module.exports = {
}
return querystring.parse(string);
},
stringify: function(object) {
stringify: function (object) {
return querystring.stringify(object);
}
};
25 changes: 15 additions & 10 deletions coreModulePackages/query-string/test.js
Expand Up @@ -13,26 +13,31 @@

var queryString = require('./index');

describe('queryString', function() {
describe('parse', function() {
['?', '#', '&'].forEach(function(char) {
it('supports leading ' + char, function() {
describe('queryString', function () {
describe('parse', function () {
['?', '#', '&'].forEach(function (char) {
it('supports leading ' + char, function () {
expect(queryString.parse(char + 'foo=bar')).toEqual({ foo: 'bar' });
});
});

it('does not support additional options supported by underlying implementation', function() {
expect(queryString.parse('foo=bar;baz=qux', ';')).not.toEqual({ foo: 'bar', baz: 'qux' });
it('does not support additional options supported by underlying implementation', function () {
expect(queryString.parse('foo=bar;baz=qux', ';')).not.toEqual({
foo: 'bar',
baz: 'qux'
});
});
});

describe('stringify', function() {
it('does not support additional options supported by underlying implementation', function() {
expect(queryString.stringify({ foo: 'bar', baz: 'qux' }, ';')).toEqual('foo=bar&baz=qux');
describe('stringify', function () {
it('does not support additional options supported by underlying implementation', function () {
expect(queryString.stringify({ foo: 'bar', baz: 'qux' }, ';')).toEqual(
'foo=bar&baz=qux'
);
});
});

it('does not expose other methods supported by the underlying implementation', function() {
it('does not expose other methods supported by the underlying implementation', function () {
expect(Object.keys(queryString).length).toBe(2);
});
});

0 comments on commit 2064e8b

Please sign in to comment.