refactor(docs-infra): correct incomplete string replacement (#51585)

Find all usages of `\n` and replace them instead of just the first.

PR Close #51585
This commit is contained in:
Joey Perrott 2023-08-30 18:28:29 +00:00 committed by Jessica Janiuk
parent c439a40db2
commit cfcd2e3aeb
4 changed files with 7 additions and 7 deletions

View file

@ -74,7 +74,7 @@ function selectHeroTests() {
it(`has selected ${targetHero.name}`, async () => {
const page = getPageElts();
const expectedText = `${targetHero.id} ${targetHero.name}`;
expect((await page.selected.getText()).replace('\n', ' ')).toBe(expectedText);
expect((await page.selected.getText()).replace(/\n/g, ' ')).toBe(expectedText);
});
it('shows selected hero details', async () => {
@ -101,7 +101,7 @@ function updateHeroTests() {
it(`shows updated hero name in list`, async () => {
const page = getPageElts();
const hero = Hero.fromString((await page.selected.getText()).replace('\n', ' '));
const hero = Hero.fromString((await page.selected.getText()).replace(/\n/g, ' '));
const newName = targetHero.name + nameSuffix;
expect(hero.id).toEqual(targetHero.id);
expect(hero.name).toEqual(newName);

View file

@ -74,7 +74,7 @@ function selectHeroTests() {
it(`has selected ${targetHero.name}`, async () => {
const page = getPageElts();
const expectedText = `${targetHero.id} ${targetHero.name}`;
expect((await page.selected.getText()).replace('\n', ' ')).toBe(expectedText);
expect((await page.selected.getText()).replace(/\n/g, ' ')).toBe(expectedText);
});
it('shows selected hero details', async () => {
@ -101,7 +101,7 @@ function updateHeroTests() {
it(`shows updated hero name in list`, async () => {
const page = getPageElts();
const hero = Hero.fromString(await (await page.selected.getText()).replace('\n', ' '));
const hero = Hero.fromString(await (await page.selected.getText()).replace(/\n/g, ' '));
const newName = targetHero.name + nameSuffix;
expect(hero.id).toEqual(targetHero.id);
expect(hero.name).toEqual(newName);

View file

@ -74,7 +74,7 @@ function selectHeroTests() {
it(`has selected ${targetHero.name}`, async () => {
const page = getPageElts();
const expectedText = `${targetHero.id} ${targetHero.name}`;
expect((await page.selected.getText()).replace('\n', ' ')).toBe(expectedText);
expect((await page.selected.getText()).replace(/\n/g, ' ')).toBe(expectedText);
});
it('shows selected hero details', async () => {
@ -106,7 +106,7 @@ function updateHeroTests() {
it(`shows updated hero name in list`, async () => {
const page = getPageElts();
const hero = Hero.fromString((await page.selected.getText()).replace('\n', ' '));
const hero = Hero.fromString((await page.selected.getText()).replace(/\n/g, ' '));
const newName = targetHero.name + nameSuffix;
expect(hero.id).toEqual(targetHero.id);
expect(hero.name).toEqual(newName);

View file

@ -64,7 +64,7 @@ const contributorsFilePath = join(__dirname, '../content/marketing/contributors.
// the page is working as expected as linkedin.com returns a `999` status for
// non-browser based requests. Other pages returning a `999` may still indicate an
// error in the request for the page.
if ([405, 999].includes(result.status) && url.hostname.includes('linkedin.com')) {
if ([405, 999].includes(result.status) && url.hostname === 'linkedin.com') {
return;
}