diff --git a/packages/workbox-build/src/entry-points/options/common-generate-schema.js b/packages/workbox-build/src/entry-points/options/common-generate-schema.js index 94504498c..aa1a302fa 100644 --- a/packages/workbox-build/src/entry-points/options/common-generate-schema.js +++ b/packages/workbox-build/src/entry-points/options/common-generate-schema.js @@ -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(), }), diff --git a/packages/workbox-build/src/lib/runtime-caching-converter.js b/packages/workbox-build/src/lib/runtime-caching-converter.js index 48dfe963e..e9682d6fa 100644 --- a/packages/workbox-build/src/lib/runtime-caching-converter.js +++ b/packages/workbox-build/src/lib/runtime-caching-converter.js @@ -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', }; diff --git a/test/workbox-build/node/lib/runtime-caching-converter.js b/test/workbox-build/node/lib/runtime-caching-converter.js index ffea8debe..47ae420d4 100644 --- a/test/workbox-build/node/lib/runtime-caching-converter.js +++ b/test/workbox-build/node/lib/runtime-caching-converter.js @@ -22,6 +22,9 @@ function validate(runtimeCachingOptions, convertedOptions) { expiration: { Plugin: sinon.spy(), }, + broadcastUpdate: { + Plugin: sinon.spy(), + }, routing: { registerRoute: sinon.spy(), }, @@ -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; + } } }); } @@ -140,6 +147,9 @@ describe(`[workbox-build] src/lib/utils/runtime-caching-converter.js`, function( cacheableResponse: { statuses: [0, 200], }, + broadcastUpdate: { + channelName: 'test', + }, }, }];