From 5b17ac84df3ec8b900d70a6a29be9acdaea40acb Mon Sep 17 00:00:00 2001 From: David Walsh Date: Mon, 14 Mar 2016 13:32:47 -0500 Subject: [PATCH] Adding test for ignoreSearch --- tests/service-worker/test.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/service-worker/test.js b/tests/service-worker/test.js index 4d78989..07f61b1 100755 --- a/tests/service-worker/test.js +++ b/tests/service-worker/test.js @@ -96,6 +96,14 @@ describe('tests', function() { }); + it('ignoreSearch works properly', function() { + // Ensure URLs are modified when local and not modified when cross-origin + assert.equal('/images/logo.png', wpOfflineShell.ignoreSearch(new Request('/images/logo.png?preview')).pathname); + + var crossOriginImage = 'https://davidwalsh.name/images/logo.png?preview'; + assert.equal(crossOriginImage, wpOfflineShell.ignoreSearch(new Request(crossOriginImage)).toString()); + }); + it('Debug option works properly', function() { // We don't want to muddle up the user's console if they option isn't on console.log = console.warn = sinon.spy();