Skip to content

Commit

Permalink
Fix incorrect casing on getCacheKeyForURL (#1885)
Browse files Browse the repository at this point in the history
  • Loading branch information
philipwalton authored and jeffposnick committed Feb 6, 2019
1 parent 823ee3f commit 348cea6
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions infra/testing/validator/service-worker-runtime.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ function setupSpiesAndContext() {
},
precaching: {
// To make testing easier, hardcode this fake URL return value.
getCacheKeyForUrl: sinon.stub().returns('/urlWithCacheKey'),
getCacheKeyForURL: sinon.stub().returns('/urlWithCacheKey'),
precacheAndRoute: sinon.spy(),
cleanupOutdatedCaches: sinon.spy(),
},
Expand Down Expand Up @@ -80,7 +80,7 @@ function setupSpiesAndContext() {
cacheExpirationPlugin: cacheExpirationPluginSpy,
CacheFirst: workbox.strategies.CacheFirst,
clientsClaim: workbox.core.clientsClaim,
getCacheKeyForUrl: workbox.precaching.getCacheKeyForUrl,
getCacheKeyForURL: workbox.precaching.getCacheKeyForURL,
googleAnalyticsInitialize: workbox.googleAnalytics.initialize,
NetworkFirst: workbox.strategies.NetworkFirst,
precacheAndRoute: workbox.precaching.precacheAndRoute,
Expand Down
2 changes: 1 addition & 1 deletion packages/workbox-build/src/templates/sw-template.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ if (Array.isArray(self.__precacheManifest)) {
}
<% } %>
<% if (cleanupOutdatedCaches) { %>workbox.precaching.cleanupOutdatedCaches();<% } %>
<% if (navigateFallback) { %>workbox.routing.registerNavigationRoute(workbox.precaching.getCacheKeyForUrl(<%= JSON.stringify(navigateFallback) %>)<% if (navigateFallbackWhitelist || navigateFallbackBlacklist) { %>, {
<% if (navigateFallback) { %>workbox.routing.registerNavigationRoute(workbox.precaching.getCacheKeyForURL(<%= JSON.stringify(navigateFallback) %>)<% if (navigateFallbackWhitelist || navigateFallbackBlacklist) { %>, {
<% if (navigateFallbackWhitelist) { %>whitelist: [<%= navigateFallbackWhitelist %>],<% } %>
<% if (navigateFallbackBlacklist) { %>blacklist: [<%= navigateFallbackBlacklist %>],<% } %>
}<% } %>);<% } %>
Expand Down
4 changes: 2 additions & 2 deletions test/workbox-build/node/entry-points/generate-sw-string.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ describe(`[workbox-build] entry-points/generate-sw-string.js (End to End)`, func
const {swString, warnings} = await generateSWString(options);
expect(warnings).to.be.empty;
await validateServiceWorkerRuntime({swString, expectedMethodCalls: {
getCacheKeyForUrl: [[navigateFallback]],
getCacheKeyForURL: [[navigateFallback]],
importScripts: [[...DEFAULT_IMPORT_SCRIPTS]],
precacheAndRoute: [[[], {}]],
registerNavigationRoute: [['/urlWithCacheKey']],
Expand All @@ -228,7 +228,7 @@ describe(`[workbox-build] entry-points/generate-sw-string.js (End to End)`, func
const {swString, warnings} = await generateSWString(options);
expect(warnings).to.be.empty;
await validateServiceWorkerRuntime({swString, expectedMethodCalls: {
getCacheKeyForUrl: [[navigateFallback]],
getCacheKeyForURL: [[navigateFallback]],
importScripts: [[...DEFAULT_IMPORT_SCRIPTS]],
precacheAndRoute: [[[], {}]],
registerNavigationRoute: [['/urlWithCacheKey', {
Expand Down
2 changes: 1 addition & 1 deletion test/workbox-build/node/entry-points/generate-sw.js
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ describe(`[workbox-build] entry-points/generate-sw.js (End to End)`, function()
expect(count).to.eql(6);
expect(size).to.eql(2604);
await validateServiceWorkerRuntime({swFile: swDest, expectedMethodCalls: {
getCacheKeyForUrl: [[navigateFallback]],
getCacheKeyForURL: [[navigateFallback]],
importScripts: [[WORKBOX_SW_CDN_URL]],
precacheAndRoute: [[[{
url: 'index.html',
Expand Down

0 comments on commit 348cea6

Please sign in to comment.