Skip to content

Commit bf1a9e6

Browse files
delucisastrobot-houston
authored andcommitted
[ci] format
1 parent b78fda4 commit bf1a9e6

File tree

3 files changed

+33
-25
lines changed

3 files changed

+33
-25
lines changed

packages/starlight/__tests__/basics/starlight-page-route-data.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ const starlightPagePathname = '/test-slug';
3333
test('adds data to route shape', async () => {
3434
const data = await generateStarlightPageRouteData({
3535
props: starlightPageProps,
36-
context: getRouteDataTestContext({pathname: starlightPagePathname}),
36+
context: getRouteDataTestContext({ pathname: starlightPagePathname }),
3737
});
3838
// Starlight pages infer the slug from the URL.
3939
expect(data.slug).toBe('test-slug');
@@ -112,7 +112,7 @@ test('adds custom frontmatter data to route shape', async () => {
112112
test('uses generated sidebar when no sidebar is provided', async () => {
113113
const data = await generateStarlightPageRouteData({
114114
props: starlightPageProps,
115-
context: getRouteDataTestContext({ pathname: '/getting-started/'}),
115+
context: getRouteDataTestContext({ pathname: '/getting-started/' }),
116116
});
117117
expect(data.sidebar).toMatchInlineSnapshot(`
118118
[
@@ -440,7 +440,7 @@ test('disables table of contents if frontmatter includes `tableOfContents: false
440440
tableOfContents: false,
441441
},
442442
},
443-
context: getRouteDataTestContext({ pathname: starlightPagePathname}),
443+
context: getRouteDataTestContext({ pathname: starlightPagePathname }),
444444
});
445445
expect(data.toc).toBeUndefined();
446446
});

packages/starlight/__tests__/head/head.test.ts

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ describe.each([['name'], ['property'], ['http-equiv']])(
127127
tag: 'meta',
128128
attrs: { [prop]: 'y', content: 'Test' },
129129
} as const;
130-
const head = getTestHead({ heads: [customMeta]});
130+
const head = getTestHead({ heads: [customMeta] });
131131
expect(
132132
head.filter(
133133
(tag) => tag.tag === 'meta' && (tag.attrs?.[prop] === 'x' || tag.attrs?.[prop] === 'y')
@@ -170,16 +170,18 @@ test('sorts head by tag importance', () => {
170170
});
171171

172172
test('places the default favicon below any user provided icons', () => {
173-
const head = getTestHead({heads: [
174-
{
175-
tag: 'link',
176-
attrs: {
177-
rel: 'icon',
178-
href: '/favicon.ico',
179-
sizes: '32x32',
173+
const head = getTestHead({
174+
heads: [
175+
{
176+
tag: 'link',
177+
attrs: {
178+
rel: 'icon',
179+
href: '/favicon.ico',
180+
sizes: '32x32',
181+
},
180182
},
181-
},
182-
]});
183+
],
184+
});
183185

184186
const defaultFaviconIndex = head.findIndex(
185187
(tag) => tag.tag === 'link' && tag.attrs?.rel === 'shortcut icon'
@@ -190,21 +192,24 @@ test('places the default favicon below any user provided icons', () => {
190192
});
191193

192194
test('omits meta og:url tag when site is not set', () => {
193-
const head = getTestHead({setSite: false});
195+
const head = getTestHead({ setSite: false });
194196

195197
const ogUrlExists = head.some((tag) => tag.tag === 'meta' && tag.attrs?.property === 'og:url');
196198

197199
expect(ogUrlExists).toBe(false);
198200
});
199201

200202
type GetTestHeadOptions = {
201-
heads?: HeadConfig,
202-
route?: Route,
203-
setSite?: boolean
204-
}
205-
206-
function getTestHead({heads = [], route = routes[0]!, setSite }: GetTestHeadOptions = {}): HeadConfig {
207-
203+
heads?: HeadConfig;
204+
route?: Route;
205+
setSite?: boolean;
206+
};
207+
208+
function getTestHead({
209+
heads = [],
210+
route = routes[0]!,
211+
setSite,
212+
}: GetTestHeadOptions = {}): HeadConfig {
208213
return generateRouteData({
209214
props: {
210215
...route,

packages/starlight/__tests__/test-utils.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,15 +107,18 @@ type RouteDataTestContextOptions = {
107107
* The pathname to get route data context for, e.g. `"/getting-started/"`.
108108
* @default "/"
109109
*/
110-
pathname?: string,
110+
pathname?: string;
111111
/**
112112
* Whether or not the context should include a value for `site`. Set to `false` to test without a `site` value.
113113
* @default true
114114
*/
115-
setSite?: boolean
116-
}
115+
setSite?: boolean;
116+
};
117117

118-
export function getRouteDataTestContext({pathname, setSite = true}: RouteDataTestContextOptions = {}): RouteDataContext {
118+
export function getRouteDataTestContext({
119+
pathname,
120+
setSite = true,
121+
}: RouteDataTestContextOptions = {}): RouteDataContext {
119122
const site = new URL('https://example.com');
120123

121124
return {

0 commit comments

Comments
 (0)