[WORLDSERVICE-464] Remove sw.js for Public Services#12566
Conversation
…-for-public-service-simorgh
|
|
||
| const invalidRoutes = [ | ||
| '/news/sw.js', | ||
| '/news/articles/sw.js', |
There was a problem hiding this comment.
I am wondering whether to add examples of all sw paths which are now invalid, for all Public Services? Especially if we have excluded them explictly from the regex.
So this would be:
- /sport/articles/sw.js
- /newsround/articles/sw.js
- /archive/articles/sw.js
- /scotland/articles/sw.js
- /naidheachdan/sgeulachdan/sw.js
|
|
||
| export const getArticleSwRegex = services => { | ||
| const serviceRegex = getServiceRegex(getWorldServices(services)); | ||
| return `/:service(${serviceRegex})/:local(${articleLocalRegex})/sw.js`; |
There was a problem hiding this comment.
Given that the articleLocalRegex was for the public services, does it now make sense to remove this, and hardcode articles instead...?
| return `/:service(${serviceRegex})/:local(${articleLocalRegex})/sw.js`; | |
| return `/:service(${serviceRegex})/articles/sw.js`; |
| export const getArticleManifestRegex = services => { | ||
| const serviceRegex = getServiceRegex(getWorldServices(services)); | ||
| return `/:service(${serviceRegex})/:local(${articleLocalRegex})/manifest.json`; |
There was a problem hiding this comment.
This is potentially out of scope (or is it? - Let's get a second opinion!) Let's do this while we're here: per my comment above anything that uses getWorldServices no longer needs articleLocalRegex. If we did change it, we would also need to update some tests.
(Note that this we recently removed manifest paths from Public Services, and we just missed this.
| export const getArticleManifestRegex = services => { | |
| const serviceRegex = getServiceRegex(getWorldServices(services)); | |
| return `/:service(${serviceRegex})/:local(${articleLocalRegex})/manifest.json`; | |
| export const getArticleManifestRegex = services => { | |
| const serviceRegex = getServiceRegex(getWorldServices(services)); | |
| return `/:service(${serviceRegex})/articles/manifest.json`; |
There was a problem hiding this comment.
That makes sense. Updated
Isabella-Mitchell
left a comment
There was a problem hiding this comment.
Looks good - one thing I noticed is we have some e2e tests which mention service worker in cypress/e2e/application/index.js. Will these be impacted? I'm taking a look to understand when we run these...
Ohhh that's a good shout, I had forgotten about that. I think we might not need to do anything, as these tests had already been removed for Public Services. I would have expected the Cypress tests to fail if we deleted something & didn't clean up the tests accordingly. |
…-for-public-service-simorgh
…-for-public-service-simorgh
…unning-sw-available [WORLDSERVICE-594] Ensure application cypress tests are running to check if service worker is available
| }); | ||
|
|
||
| describe('Service workers', () => { | ||
| it('should serve a file for existing service workers', async () => { |
There was a problem hiding this comment.
Can we make sure there's still a test for existence of /world-service/sw.js? (choose one of the world services as an example)
There was a problem hiding this comment.
Oops, we should def keep it. Updated
| ); | ||
| }); | ||
|
|
||
| it('should not serve a file for non-existing service workers', async () => { |
There was a problem hiding this comment.
Could we update this test to use one of the public services as the test (instead of some-service)
…-for-public-service-simorgh
karinathomasbbc
left a comment
There was a problem hiding this comment.
Great stuff, thanks for this, and for some excellent cleaning up 🧹
…-for-public-service-simorgh
Resolves JIRA: https://jira.dev.bbc.co.uk/browse/WORLDSERVICE-464
Summary
Removes sw.js for remaining Public Services
Code changes
swPathfromarchiveandscotlandconfigsgetWorldServicesutil to includescotlandin thepublicServiceslistgetArticleSwRegexandgetSwRegexto only use WSDeveloper Checklist
Testing
Ready-For-Test, Local)Ready-For-Test, Test)Ready-For-Test, Preview)Ready-For-Test, Live)Additional Testing Steps
Useful Links