Skip to content

Commit ead49a9

Browse files
committed
update for new changes
1 parent eec0520 commit ead49a9

File tree

2 files changed

+19
-32
lines changed

2 files changed

+19
-32
lines changed

index.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,7 @@ Liftoff.prototype.buildEnvironment = function (opts) {
164164
}
165165
});
166166

167-
var additionPreloads = arrayFind(Object.keys(config), function (key) {
168-
var cfg = config[key];
167+
var additionPreloads = arrayFind(config, function (cfg) {
169168
if (Object.prototype.hasOwnProperty.call(cfg, 'preload')) {
170169
if (Array.isArray(cfg.preload)) {
171170
if (cfg.preload.every(isString)) {

test/index.js

Lines changed: 18 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -607,11 +607,9 @@ describe('Liftoff', function () {
607607
it('adds array of preloads specified in config', function (done) {
608608
var app = new Liftoff({
609609
name: 'myapp',
610-
configFiles: {
611-
'preload-array': [
612-
{ path: 'test/fixtures/configfiles', extensions: ['.js'] }
613-
],
614-
},
610+
configFiles: [
611+
{ name: 'preload-array', path: 'test/fixtures/configfiles', extensions: ['.js'] }
612+
],
615613
});
616614
app.prepare({}, function (env) {
617615
expect(env.preload).toEqual(['abc', 'xyz']);
@@ -622,11 +620,9 @@ describe('Liftoff', function () {
622620
it('combines array of preloads specified in config', function (done) {
623621
var app = new Liftoff({
624622
name: 'myapp',
625-
configFiles: {
626-
'preload-array': [
627-
{ path: 'test/fixtures/configfiles', extensions: ['.js'] }
628-
],
629-
},
623+
configFiles: [
624+
{ name: 'preload-array', path: 'test/fixtures/configfiles', extensions: ['.js'] }
625+
],
630626
});
631627
app.prepare({
632628
preload: ['123']
@@ -639,11 +635,9 @@ describe('Liftoff', function () {
639635
it('adds string preload specified in config', function (done) {
640636
var app = new Liftoff({
641637
name: 'myapp',
642-
configFiles: {
643-
'preload-string': [
644-
{ path: 'test/fixtures/configfiles', extensions: ['.js'] }
645-
],
646-
},
638+
configFiles: [
639+
{ name: 'preload-string', path: 'test/fixtures/configfiles', extensions: ['.js'] }
640+
],
647641
});
648642
app.prepare({}, function (env) {
649643
expect(env.preload).toEqual(['abc']);
@@ -654,11 +648,9 @@ describe('Liftoff', function () {
654648
it('combines string preload specified in config', function (done) {
655649
var app = new Liftoff({
656650
name: 'myapp',
657-
configFiles: {
658-
'preload-string': [
659-
{ path: 'test/fixtures/configfiles', extensions: ['.js'] }
660-
],
661-
},
651+
configFiles: [
652+
{ name: 'preload-string', path: 'test/fixtures/configfiles', extensions: ['.js'] }
653+
],
662654
});
663655
app.prepare({
664656
preload: ['xyz']
@@ -671,11 +663,9 @@ describe('Liftoff', function () {
671663
it('ignores non-string/non-array preload specified in config', function (done) {
672664
var app = new Liftoff({
673665
name: 'myapp',
674-
configFiles: {
675-
'preload-invalid': [
676-
{ path: 'test/fixtures/configfiles', extensions: ['.js'] }
677-
],
678-
},
666+
configFiles: [
667+
{ name: 'preload-invalid', path: 'test/fixtures/configfiles', extensions: ['.js'] }
668+
],
679669
});
680670
app.prepare({}, function (env) {
681671
expect(env.preload).toEqual([]);
@@ -686,11 +676,9 @@ describe('Liftoff', function () {
686676
it('ignores array with any non-strings preload specified in config', function (done) {
687677
var app = new Liftoff({
688678
name: 'myapp',
689-
configFiles: {
690-
'preload-invalid-array': [
691-
{ path: 'test/fixtures/configfiles', extensions: ['.js'] }
692-
],
693-
},
679+
configFiles: [
680+
{ name: 'preload-invalid-array', path: 'test/fixtures/configfiles', extensions: ['.js'] }
681+
],
694682
});
695683
app.prepare({}, function (env) {
696684
expect(env.preload).toEqual([]);

0 commit comments

Comments
 (0)