Skip to content

Commit

Permalink
Consistently use broadcastUpdate instead of broadcastCacheUpdate (#1292)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffposnick authored Feb 10, 2018
1 parent bf7c478 commit e5bf6ca
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ module.exports = baseSchema.keys({
name: joi.string().required(),
options: joi.object(),
}),
broadcastCacheUpdate: joi.object().keys({
broadcastUpdate: joi.object().keys({
channelName: joi.string().required(),
options: joi.object(),
}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ function getOptionsString(options = {}) {

const pluginsMapping = {
backgroundSync: 'workbox.backgroundSync.Plugin',
broadcastCacheUpdate: 'workbox.broadcastCacheUpdate.Plugin',
broadcastUpdate: 'workbox.broadcastUpdate.Plugin',
expiration: 'workbox.expiration.Plugin',
cacheableResponse: 'workbox.cacheableResponse.Plugin',
};
Expand Down
10 changes: 10 additions & 0 deletions test/workbox-build/node/lib/runtime-caching-converter.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ function validate(runtimeCachingOptions, convertedOptions) {
expiration: {
Plugin: sinon.spy(),
},
broadcastUpdate: {
Plugin: sinon.spy(),
},
routing: {
registerRoute: sinon.spy(),
},
Expand Down Expand Up @@ -76,6 +79,10 @@ function validate(runtimeCachingOptions, convertedOptions) {
if (options.cacheableResponse) {
expect(globalScope.workbox.cacheableResponse.Plugin.calledWith(options.cacheableResponse)).to.be.true;
}

if (options.broadcastUpdate) {
expect(globalScope.workbox.broadcastUpdate.Plugin.calledWith(options.broadcastUpdate)).to.be.true;
}
}
});
}
Expand Down Expand Up @@ -140,6 +147,9 @@ describe(`[workbox-build] src/lib/utils/runtime-caching-converter.js`, function(
cacheableResponse: {
statuses: [0, 200],
},
broadcastUpdate: {
channelName: 'test',
},
},
}];

Expand Down

0 comments on commit e5bf6ca

Please sign in to comment.