Skip to content

Commit

Permalink
update for new changes
Browse files Browse the repository at this point in the history
  • Loading branch information
phated committed Mar 16, 2024
1 parent eec0520 commit ead49a9
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 32 deletions.
3 changes: 1 addition & 2 deletions index.js
Expand Up @@ -164,8 +164,7 @@ Liftoff.prototype.buildEnvironment = function (opts) {
}
});

var additionPreloads = arrayFind(Object.keys(config), function (key) {
var cfg = config[key];
var additionPreloads = arrayFind(config, function (cfg) {
if (Object.prototype.hasOwnProperty.call(cfg, 'preload')) {
if (Array.isArray(cfg.preload)) {
if (cfg.preload.every(isString)) {
Expand Down
48 changes: 18 additions & 30 deletions test/index.js
Expand Up @@ -607,11 +607,9 @@ describe('Liftoff', function () {
it('adds array of preloads specified in config', function (done) {
var app = new Liftoff({
name: 'myapp',
configFiles: {
'preload-array': [
{ path: 'test/fixtures/configfiles', extensions: ['.js'] }
],
},
configFiles: [
{ name: 'preload-array', path: 'test/fixtures/configfiles', extensions: ['.js'] }
],
});
app.prepare({}, function (env) {
expect(env.preload).toEqual(['abc', 'xyz']);
Expand All @@ -622,11 +620,9 @@ describe('Liftoff', function () {
it('combines array of preloads specified in config', function (done) {
var app = new Liftoff({
name: 'myapp',
configFiles: {
'preload-array': [
{ path: 'test/fixtures/configfiles', extensions: ['.js'] }
],
},
configFiles: [
{ name: 'preload-array', path: 'test/fixtures/configfiles', extensions: ['.js'] }
],
});
app.prepare({
preload: ['123']
Expand All @@ -639,11 +635,9 @@ describe('Liftoff', function () {
it('adds string preload specified in config', function (done) {
var app = new Liftoff({
name: 'myapp',
configFiles: {
'preload-string': [
{ path: 'test/fixtures/configfiles', extensions: ['.js'] }
],
},
configFiles: [
{ name: 'preload-string', path: 'test/fixtures/configfiles', extensions: ['.js'] }
],
});
app.prepare({}, function (env) {
expect(env.preload).toEqual(['abc']);
Expand All @@ -654,11 +648,9 @@ describe('Liftoff', function () {
it('combines string preload specified in config', function (done) {
var app = new Liftoff({
name: 'myapp',
configFiles: {
'preload-string': [
{ path: 'test/fixtures/configfiles', extensions: ['.js'] }
],
},
configFiles: [
{ name: 'preload-string', path: 'test/fixtures/configfiles', extensions: ['.js'] }
],
});
app.prepare({
preload: ['xyz']
Expand All @@ -671,11 +663,9 @@ describe('Liftoff', function () {
it('ignores non-string/non-array preload specified in config', function (done) {
var app = new Liftoff({
name: 'myapp',
configFiles: {
'preload-invalid': [
{ path: 'test/fixtures/configfiles', extensions: ['.js'] }
],
},
configFiles: [
{ name: 'preload-invalid', path: 'test/fixtures/configfiles', extensions: ['.js'] }
],
});
app.prepare({}, function (env) {
expect(env.preload).toEqual([]);
Expand All @@ -686,11 +676,9 @@ describe('Liftoff', function () {
it('ignores array with any non-strings preload specified in config', function (done) {
var app = new Liftoff({
name: 'myapp',
configFiles: {
'preload-invalid-array': [
{ path: 'test/fixtures/configfiles', extensions: ['.js'] }
],
},
configFiles: [
{ name: 'preload-invalid-array', path: 'test/fixtures/configfiles', extensions: ['.js'] }
],
});
app.prepare({}, function (env) {
expect(env.preload).toEqual([]);
Expand Down

0 comments on commit ead49a9

Please sign in to comment.