2018-02-27 18:24:07 -05:00
|
|
|
import { loadLegacyUrls, loadLocalSitemapUrls, loadSWRoutes } from '../shared/helpers';
|
2018-01-25 15:19:32 -05:00
|
|
|
|
2017-11-28 13:13:52 -05:00
|
|
|
// NOTE: The new `@angular/service-worker` does not support configurable routes.
|
|
|
|
xdescribe('service-worker routes', () => {
|
2018-01-25 15:19:32 -05:00
|
|
|
|
2018-02-27 18:24:07 -05:00
|
|
|
loadLocalSitemapUrls().forEach(url => {
|
2018-01-25 15:19:32 -05:00
|
|
|
it('should process URLs in the Sitemap', () => {
|
|
|
|
const routes = loadSWRoutes();
|
|
|
|
expect(routes.some(test => test(url))).toBeTruthy(url);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
loadLegacyUrls().forEach(urlPair => {
|
|
|
|
const url = urlPair[0];
|
|
|
|
it('should ignore legacy URLs that will be redirected', () => {
|
|
|
|
const routes = loadSWRoutes();
|
|
|
|
expect(routes.some(test => test(url))).toBeFalsy(url);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should ignore stackblitz URLs', () => {
|
|
|
|
const routes = loadSWRoutes();
|
2018-05-01 16:54:03 -04:00
|
|
|
|
|
|
|
// Normal StackBlitz URLs.
|
2018-01-25 15:19:32 -05:00
|
|
|
expect(routes.some(test => test('/generated/live-examples/toh-pt6/stackblitz.html'))).toBeFalsy();
|
|
|
|
expect(routes.some(test => test('/generated/live-examples/toh-pt6/stackblitz'))).toBeFalsy();
|
2018-05-01 16:54:03 -04:00
|
|
|
|
|
|
|
// Embedded StackBlitz URLs.
|
|
|
|
expect(routes.some(test => test('/generated/live-examples/toh-pt6/stackblitz.html?ctl=1'))).toBeFalsy();
|
|
|
|
expect(routes.some(test => test('/generated/live-examples/toh-pt6/stackblitz?ctl=1'))).toBeFalsy();
|
2018-01-25 15:19:32 -05:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should ignore URLs to files with extensions', () => {
|
|
|
|
const routes = loadSWRoutes();
|
|
|
|
expect(routes.some(test => test('/generated/zips/animations/animations.zip'))).toBeFalsy();
|
|
|
|
expect(routes.some(test => test('/generated/images/guide/animations/animation_auto.gif'))).toBeFalsy();
|
|
|
|
expect(routes.some(test => test('/generated/ie-polyfills.min.js'))).toBeFalsy();
|
|
|
|
expect(routes.some(test => test('/generated/docs/guide/animations.json'))).toBeFalsy();
|
|
|
|
});
|
|
|
|
});
|