Skip to content

Commit 7fc779d

Browse files
authored
fix!: drop implicit context (#459)
1 parent 501c9e2 commit 7fc779d

File tree

133 files changed

+941
-1142
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

133 files changed

+941
-1142
lines changed

packages/schema-org/src/nodes/AggregateOffer/index.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ import { injectSchemaOrg, useSetup } from '../../../test'
44

55
describe('defineAggregateOffer', () => {
66
it('can be registered simple', async () => {
7-
await useSetup(async () => {
8-
useSchemaOrg([
7+
await useSetup(async (head) => {
8+
useSchemaOrg(head, [
99
defineAggregateOffer({
1010
lowPrice: 100,
1111
highPrice: 200,
1212
}),
1313
])
1414

15-
const tag = await injectSchemaOrg()
15+
const tag = await injectSchemaOrg(head)
1616

1717
expect(tag).toMatchInlineSnapshot(`
1818
[
@@ -29,8 +29,8 @@ describe('defineAggregateOffer', () => {
2929
})
3030

3131
it('can be registered offers', async () => {
32-
await useSetup(async () => {
33-
useSchemaOrg([
32+
await useSetup(async (head) => {
33+
useSchemaOrg(head, [
3434
defineAggregateOffer({
3535
lowPrice: 100,
3636
highPrice: 200,
@@ -47,7 +47,7 @@ describe('defineAggregateOffer', () => {
4747
}),
4848
])
4949

50-
const tag = await injectSchemaOrg()
50+
const tag = await injectSchemaOrg(head)
5151

5252
expect(tag).toMatchInlineSnapshot(`
5353
[

packages/schema-org/src/nodes/Article/index.test.ts

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ const defaultArticleInput = {
1515

1616
describe('defineArticle', () => {
1717
it('can be registered', async () => {
18-
await useSetup(async () => {
19-
useSchemaOrg([
18+
await useSetup(async (head) => {
19+
useSchemaOrg(head, [
2020
defineArticle(defaultArticleInput),
2121
])
2222

23-
const client = await injectSchemaOrg()
23+
const client = await injectSchemaOrg(head)
2424

2525
expect(client).toMatchInlineSnapshot(`
2626
[
@@ -50,14 +50,14 @@ describe('defineArticle', () => {
5050
})
5151

5252
it('inherits attributes from useRoute()', async () => {
53-
await useSetup(async () => {
54-
useSchemaOrg([
53+
await useSetup(async (head) => {
54+
useSchemaOrg(head, [
5555
defineArticle(),
5656
])
5757

58-
const client = await injectSchemaOrg()
58+
const client = await injectSchemaOrg(head)
5959

60-
const article = await findNode<Article>('#article')
60+
const article = await findNode<Article>(head, '#article')
6161
expect(article?.headline).toEqual('Article headline')
6262
expect(article?.description).toEqual('my article description')
6363
expect(article?.image).toMatchInlineSnapshot(`
@@ -102,8 +102,8 @@ describe('defineArticle', () => {
102102
})
103103

104104
it('can define article with custom fields', async () => {
105-
await useSetup(async () => {
106-
useSchemaOrg([
105+
await useSetup(async (head) => {
106+
useSchemaOrg(head, [
107107
defineArticle<{ somethingNew: 'test' }>({
108108
headline: 'test',
109109
datePublished: mockDate,
@@ -112,7 +112,7 @@ describe('defineArticle', () => {
112112
}),
113113
])
114114

115-
const client = await injectSchemaOrg()
115+
const client = await injectSchemaOrg(head)
116116
expect(client).toMatchInlineSnapshot(`
117117
[
118118
{
@@ -130,25 +130,25 @@ describe('defineArticle', () => {
130130
})
131131

132132
it('passes Date objects into iso string', async () => {
133-
await useSetup(async () => {
134-
useSchemaOrg([
133+
await useSetup(async (head) => {
134+
useSchemaOrg(head, [
135135
defineArticle({
136136
...defaultArticleInput,
137137
datePublished: new Date(Date.UTC(2021, 10, 1, 0, 0, 0)),
138138
dateModified: new Date(Date.UTC(2022, 1, 1, 0, 0, 0)),
139139
}),
140140
])
141141

142-
const client = await injectSchemaOrg()
142+
const client = await injectSchemaOrg(head)
143143
const article = client[0]
144144
expect(article?.datePublished).toEqual('2021-11-01T00:00:00.000Z')
145145
expect(article?.dateModified).toEqual('2022-02-01T00:00:00.000Z')
146146
})
147147
})
148148

149149
it('allows overriding the type', async () => {
150-
await useSetup(async () => {
151-
useSchemaOrg([
150+
await useSetup(async (head) => {
151+
useSchemaOrg(head, [
152152
defineArticle({
153153
'@type': 'TechArticle',
154154
...defaultArticleInput,
@@ -157,21 +157,21 @@ describe('defineArticle', () => {
157157
}),
158158
])
159159

160-
const client = await injectSchemaOrg()
160+
const client = await injectSchemaOrg(head)
161161
const article = client[0]
162162

163163
expect(article?.['@type']).toEqual(['Article', 'TechArticle'])
164164
})
165165
})
166166

167167
it('adds read action to web page', async () => {
168-
await useSetup(async () => {
169-
useSchemaOrg([
168+
await useSetup(async (head) => {
169+
useSchemaOrg(head, [
170170
defineWebPage(),
171171
defineArticle(defaultArticleInput),
172172
])
173173

174-
const client = await injectSchemaOrg()
174+
const client = await injectSchemaOrg(head)
175175
const webpage = client[0]
176176

177177
expect(webpage?.potentialAction).toMatchInlineSnapshot(`
@@ -188,8 +188,8 @@ describe('defineArticle', () => {
188188
})
189189

190190
it('clones date to web page', async () => {
191-
await useSetup(async () => {
192-
useSchemaOrg([
191+
await useSetup(async (head) => {
192+
useSchemaOrg(head, [
193193
defineWebPage(),
194194
defineArticle({
195195
'@id': '#my-article',
@@ -199,7 +199,7 @@ describe('defineArticle', () => {
199199
}),
200200
])
201201

202-
const client = await injectSchemaOrg()
202+
const client = await injectSchemaOrg(head)
203203
const webpage = client[0]
204204
const article = client[1]
205205

@@ -209,8 +209,8 @@ describe('defineArticle', () => {
209209
})
210210

211211
it('handles custom author', async () => {
212-
await useSetup(async () => {
213-
useSchemaOrg([
212+
await useSetup(async (head) => {
213+
useSchemaOrg(head, [
214214
defineOrganization({
215215
name: 'Identity',
216216
logo: 'test.png',
@@ -227,7 +227,7 @@ describe('defineArticle', () => {
227227
}),
228228
])
229229

230-
const client = await injectSchemaOrg()
230+
const client = await injectSchemaOrg(head)
231231

232232
expect(client[2]).toMatchInlineSnapshot(`
233233
{
@@ -274,8 +274,8 @@ describe('defineArticle', () => {
274274
})
275275

276276
it('handles custom authors', async () => {
277-
await useSetup(async () => {
278-
useSchemaOrg([
277+
await useSetup(async (head) => {
278+
useSchemaOrg(head, [
279279
defineOrganization({
280280
name: 'Identity',
281281
logo: '/test.png',
@@ -296,7 +296,7 @@ describe('defineArticle', () => {
296296
}),
297297
])
298298

299-
const client = await injectSchemaOrg()
299+
const client = await injectSchemaOrg(head)
300300

301301
expect(client).toMatchInlineSnapshot(`
302302
[
@@ -397,16 +397,16 @@ describe('defineArticle', () => {
397397
})
398398

399399
it('can match yoast schema', async () => {
400-
await useSetup(async () => {
401-
useSchemaOrg([
400+
await useSetup(async (head) => {
401+
useSchemaOrg(head, [
402402
defineOrganization({
403403
name: 'Kootingal Pecan Company',
404404
logo: 'test',
405405
}),
406406
defineWebPage(),
407407
])
408408

409-
useSchemaOrg([
409+
useSchemaOrg(head, [
410410
defineArticle({
411411
wordCount: 381,
412412
datePublished: '2022-04-06T08:00:51+00:00',
@@ -430,7 +430,7 @@ describe('defineArticle', () => {
430430
}),
431431
])
432432

433-
const client = await injectSchemaOrg()
433+
const client = await injectSchemaOrg(head)
434434

435435
expect(client[2]).toMatchInlineSnapshot(`
436436
{

packages/schema-org/src/nodes/Book/index.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import { injectSchemaOrg, useSetup } from '../../../test'
44

55
describe('defineBook', () => {
66
it('can be registered', async () => {
7-
await useSetup(async () => {
8-
useSchemaOrg([
7+
await useSetup(async (head) => {
8+
useSchemaOrg(head, [
99
defineBook({
1010
url: 'http://example.com/work/the_catcher_in_the_rye',
1111
name: 'The Catcher in the Rye',
@@ -31,7 +31,7 @@ describe('defineBook', () => {
3131
}),
3232
])
3333

34-
const graphNodes = await injectSchemaOrg()
34+
const graphNodes = await injectSchemaOrg(head)
3535

3636
expect(graphNodes).toMatchInlineSnapshot(`
3737
[

packages/schema-org/src/nodes/Breadcrumb/index.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import { injectSchemaOrg, useSetup } from '../../../test'
44

55
describe('defineBreadcrumb', async () => {
66
it('can be registered', async () => {
7-
await useSetup(async () => {
8-
useSchemaOrg([
7+
await useSetup(async (head) => {
8+
useSchemaOrg(head, [
99
defineBreadcrumb({
1010
itemListElement: [
1111
{ name: 'Home', item: '/' },
@@ -15,7 +15,7 @@ describe('defineBreadcrumb', async () => {
1515
}),
1616
])
1717

18-
const breadcrumbs = await injectSchemaOrg()
18+
const breadcrumbs = await injectSchemaOrg(head)
1919

2020
expect(breadcrumbs).toMatchInlineSnapshot(`
2121
[
@@ -48,8 +48,8 @@ describe('defineBreadcrumb', async () => {
4848
})
4949

5050
it('can handle duplicate', async () => {
51-
await useSetup(async () => {
52-
useSchemaOrg([
51+
await useSetup(async (head) => {
52+
useSchemaOrg(head, [
5353
defineBreadcrumb({
5454
itemListElement: [
5555
{ name: 'Home', item: '/', position: 1 },
@@ -80,7 +80,7 @@ describe('defineBreadcrumb', async () => {
8080
}),
8181
])
8282

83-
const client = await injectSchemaOrg()
83+
const client = await injectSchemaOrg(head)
8484

8585
expect(client).toMatchInlineSnapshot(`
8686
[

packages/schema-org/src/nodes/Comment/index.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import { injectSchemaOrg, useSetup } from '../../../test'
44

55
describe('defineComment', () => {
66
it('can be registered', async () => {
7-
await useSetup(async () => {
8-
useSchemaOrg([
7+
await useSetup(async (head) => {
8+
useSchemaOrg(head, [
99
defineComment({
1010
text: 'This is a comment',
1111
author: {
@@ -14,7 +14,7 @@ describe('defineComment', () => {
1414
}),
1515
])
1616

17-
const graphNodes = await injectSchemaOrg()
17+
const graphNodes = await injectSchemaOrg(head)
1818
expect(graphNodes).toMatchInlineSnapshot(`
1919
[
2020
{

packages/schema-org/src/nodes/Course/index.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import { injectSchemaOrg, useSetup } from '../../../test'
44

55
describe('defineCourse', () => {
66
it('can be registered', async () => {
7-
await useSetup(async () => {
8-
useSchemaOrg([
7+
await useSetup(async (head) => {
8+
useSchemaOrg(head, [
99
defineCourse({
1010
name: 'Introduction to Computer Science and Programming',
1111
description: 'Introductory CS course laying out the basics.',
@@ -16,7 +16,7 @@ describe('defineCourse', () => {
1616
}),
1717
])
1818

19-
const graphNodes = await injectSchemaOrg()
19+
const graphNodes = await injectSchemaOrg(head)
2020

2121
expect(graphNodes).toMatchInlineSnapshot(`
2222
[

0 commit comments

Comments
 (0)