Skip to content

Commit

Permalink
use getlanguages from utils
Browse files Browse the repository at this point in the history
  • Loading branch information
clari182 committed Nov 18, 2024
1 parent 730b529 commit 33de9d8
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import sinon from 'sinon';
import createCitationPages from '../../../page-creators/createCitationPages';
import { CreatePagesArgs } from 'gatsby';
import { expect } from '@playwright/test';
import { test } from '../../utils';
import { getLanguages, test } from '../../utils';

test.describe('createCitationPages', () => {
let graphql: sinon.SinonStub;
Expand Down Expand Up @@ -62,40 +62,7 @@ test.describe('createCitationPages', () => {
extensions: {},
};

const languages = [
{
code: 'en',
hrefLang: 'en-US',
name: 'English',
localName: 'English',
langDir: 'ltr',
dateFormat: 'MM/DD/YYYY',
},
{
code: 'es',
hrefLang: 'es',
name: 'Spanish',
localName: 'Español',
langDir: 'ltr',
dateFormat: 'DD-MM-YYYY',
},
{
code: 'fr',
hrefLang: 'fr',
name: 'French',
localName: 'Français',
langDir: 'ltr',
dateFormat: 'DD-MM-YYYY',
},
{
code: 'ja',
hrefLang: 'ja',
name: 'Japanese',
localName: '日本語',
langDir: 'ltr',
dateFormat: 'YYYY/MM/DD',
},
];
const languages = getLanguages();

test.beforeEach(() => {
graphql = sinon.stub();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import sinon from 'sinon';
import createReportPages from '../../../page-creators/createReportPages';
import { CreatePagesArgs } from 'gatsby';
import { expect } from '@playwright/test';
import { test } from '../../utils';
import { getLanguages, test } from '../../utils';

test.describe('createReportPages', () => {
let graphql: sinon.SinonStub;
Expand All @@ -19,12 +19,7 @@ test.describe('createReportPages', () => {
},
};

const languages = [
{ code: 'en', hrefLang: 'en-US', name: 'English', localName: 'English', langDir: 'ltr', dateFormat: 'MM/DD/YYYY' },
{ code: 'es', hrefLang: 'es', name: 'Spanish', localName: 'Español', langDir: 'ltr', dateFormat: 'DD-MM-YYYY' },
{ code: 'fr', hrefLang: 'fr', name: 'French', localName: 'Français', langDir: 'ltr', dateFormat: 'DD-MM-YYYY' },
{ code: 'ja', hrefLang: 'ja', name: 'Japanese', localName: '日本語', langDir: 'ltr', dateFormat: 'YYYY/MM/DD' },
];
const languages = getLanguages();

test.beforeEach(() => {
graphql = sinon.stub();
Expand Down
9 changes: 9 additions & 0 deletions site/gatsby-site/playwright/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -282,3 +282,12 @@ export async function fillAutoComplete(page: Page, selector: string, sequence: s
await page.getByText(target).first().click({ timeout: 1000 });
}).toPass();
}

export function getLanguages() {
return [
{ code: 'en', hrefLang: 'en-US', name: 'English', localName: 'English', langDir: 'ltr', dateFormat: 'MM/DD/YYYY' },
{ code: 'es', hrefLang: 'es', name: 'Spanish', localName: 'Español', langDir: 'ltr', dateFormat: 'DD-MM-YYYY' },
{ code: 'fr', hrefLang: 'fr', name: 'French', localName: 'Français', langDir: 'ltr', dateFormat: 'DD-MM-YYYY' },
{ code: 'ja', hrefLang: 'ja', name: 'Japanese', localName: '日本語', langDir: 'ltr', dateFormat: 'YYYY/MM/DD' },
];
}

0 comments on commit 33de9d8

Please sign in to comment.