build(aio): test Firebase hosting redirection configuration (#21763)
PR Close #21763
This commit is contained in:

committed by
Alex Rickabaugh

parent
339ca83f9d
commit
bf29936af9
31
aio/tests/deployment/testFirebaseRedirection.spec.ts
Normal file
31
aio/tests/deployment/testFirebaseRedirection.spec.ts
Normal file
@ -0,0 +1,31 @@
|
||||
import { getRedirector, loadLegacyUrls, loadRedirects, loadSitemapUrls } from './helpers';
|
||||
|
||||
describe('firebase.json redirect config', () => {
|
||||
describe('with sitemap urls', () => {
|
||||
loadSitemapUrls().forEach(url => {
|
||||
it('should not redirect any urls in the sitemap', () => {
|
||||
expect(getRedirector().redirect(url)).toEqual(url);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('with legacy urls', () => {
|
||||
loadLegacyUrls().forEach(urlPair => {
|
||||
it('should redirect the legacy urls', () => {
|
||||
const redirector = getRedirector();
|
||||
expect(redirector.redirect(urlPair[0])).not.toEqual(urlPair[0]);
|
||||
if (urlPair[1]) {
|
||||
expect(redirector.redirect(urlPair[0])).toEqual(urlPair[1]);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
describe('destinations', () => {
|
||||
loadRedirects().forEach(redirect => {
|
||||
it('should match pattern "^(https?:/)?/.*"', () => {
|
||||
expect(redirect.destination).toMatch(/^(https?:\/)?\/.*/);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
Reference in New Issue
Block a user