test(docs-infra): make it easier to identify the failing URL in testFirebaseRedirection.spec.ts
(#41842)
This commit includes the URL under test in the test description in `testFirebaseRedirection.spec.ts` to make it easier to identify the affected URL when a test fails. It also avoids unnecessarily creating multiple `FirebaseRedirector` instances by sharing instances between tests. PR Close #41842
This commit is contained in:
parent
d1f5a9e44b
commit
1aee5a79c6
@ -2,20 +2,25 @@ import { getRedirector, loadLegacyUrls, loadLocalSitemapUrls, loadRedirects } fr
|
|||||||
|
|
||||||
describe('firebase.json redirect config', () => {
|
describe('firebase.json redirect config', () => {
|
||||||
describe('with sitemap urls', () => {
|
describe('with sitemap urls', () => {
|
||||||
|
const redirector = getRedirector();
|
||||||
|
|
||||||
loadLocalSitemapUrls().forEach(url => {
|
loadLocalSitemapUrls().forEach(url => {
|
||||||
it('should not redirect any urls in the sitemap', () => {
|
it(`should not redirect sitemap URL '${url}'`, () => {
|
||||||
expect(getRedirector().redirect(url)).toEqual(url);
|
expect(redirector.redirect(url)).toEqual(url);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('with legacy urls', () => {
|
describe('with legacy urls', () => {
|
||||||
|
const redirector = getRedirector();
|
||||||
|
|
||||||
loadLegacyUrls().forEach(urlPair => {
|
loadLegacyUrls().forEach(urlPair => {
|
||||||
it('should redirect the legacy urls', () => {
|
it(`should redirect legacy URL '${urlPair[0]}'`, () => {
|
||||||
const redirector = getRedirector();
|
const redirected = redirector.redirect(urlPair[0]);
|
||||||
expect(redirector.redirect(urlPair[0])).not.toEqual(urlPair[0]);
|
|
||||||
|
expect(redirected).not.toEqual(urlPair[0]);
|
||||||
if (urlPair[1]) {
|
if (urlPair[1]) {
|
||||||
expect(redirector.redirect(urlPair[0])).toEqual(urlPair[1]);
|
expect(redirected).toEqual(urlPair[1]);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user