Skip to content

Commit 25c9be8

Browse files
committed
Fix tests
1 parent de00551 commit 25c9be8

16 files changed

Lines changed: 87 additions & 65 deletions

packages/core-json-ld/src/orgSchema/Action.spec.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { describe, expect, test } from '@jest/globals';
22
import { parse } from 'valibot';
3-
import { actionSchema, parseAction } from './Action.js';
4-
import { userReviewSchema } from './UserReview.js';
3+
import { actionSchema, parseAction } from './Action';
4+
import { userReviewSchema } from './UserReview';
55

66
const actionTemplate = parse(actionSchema, {});
77
const userReviewTemplate = parse(userReviewSchema, {});
@@ -16,7 +16,7 @@ describe('Action', () => {
1616
})
1717
).toEqual({
1818
...actionTemplate,
19-
'@type': 'Action',
19+
'@type': ['Action'],
2020
actionStatus: ['ActiveActionStatus']
2121
}));
2222

@@ -25,11 +25,12 @@ describe('Action', () => {
2525
expect(
2626
parseAction({
2727
'@type': 'Action',
28+
// @ts-expect-error
2829
actionStatus: 'ABC'
2930
})
3031
).toEqual({
3132
...actionTemplate,
32-
'@type': 'Action',
33+
'@type': ['Action'],
3334
actionStatus: []
3435
});
3536
} catch (err) {
@@ -53,12 +54,12 @@ describe('Action', () => {
5354
})
5455
).toEqual({
5556
...actionTemplate,
56-
'@type': 'LikeAction',
57+
'@type': ['LikeAction'],
5758
actionStatus: ['PotentialActionStatus'],
5859
result: [
5960
{
6061
...userReviewTemplate,
61-
'@type': 'UserReview',
62+
'@type': ['UserReview'],
6263
reviewAspect: ['Hello, World!']
6364
}
6465
]

packages/core-json-ld/src/orgSchema/Action.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { intersect, lazy, object, parser, string, type GenericSchema } from 'valibot';
2-
import { actionStatusSchema, type ActionStatusInput, type ActionStatusOutput } from './ActionStatus.js';
3-
import jsonLinkedDataProperty from '../private/jsonLinkedDataProperty.js';
4-
import { projectSchema, type ProjectInput, type ProjectOutput } from './Project.js';
5-
import { thingSchema, type ThingInput, type ThingOutput } from './Thing.js';
6-
import { userReviewSchema, type UserReviewInput, type UserReviewOutput } from './UserReview.js';
2+
import { actionStatusSchema, type ActionStatusInput, type ActionStatusOutput } from './ActionStatus';
3+
import jsonLinkedDataProperty from '../private/jsonLinkedDataProperty';
4+
import { projectSchema, type ProjectInput, type ProjectOutput } from './Project';
5+
import { thingSchema, type ThingInput, type ThingOutput } from './Thing';
6+
import { userReviewSchema, type UserReviewInput, type UserReviewOutput } from './UserReview';
77

88
/**
99
* An action performed by a direct agent and indirect participants upon a direct object. Optionally happens at a location with the help of an inanimate instrument. The execution of the action may produce a result. Specific action sub-type documentation specifies the exact expectation of each argument/role.

packages/core-json-ld/src/orgSchema/Claim.spec.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { describe, expect, test } from '@jest/globals';
22
import { parse } from 'valibot';
3-
import { claimSchema } from './Claim.js';
4-
import { creativeWorkSchema } from './CreativeWork.js';
5-
import { projectSchema } from './Project.js';
3+
import { claimSchema } from './Claim';
4+
import { creativeWorkSchema } from './CreativeWork';
5+
import { projectSchema } from './Project';
66

77
const claimTemplate = parse(claimSchema, {});
88
const creativeWorkTemplate = parse(creativeWorkSchema, {});
@@ -20,11 +20,11 @@ describe('Claim', () => {
2020
})
2121
).toEqual({
2222
...claimTemplate,
23-
'@type': 'Claim',
23+
'@type': ['Claim'],
2424
appearance: [
2525
{
2626
...creativeWorkTemplate,
27-
'@type': 'Book',
27+
'@type': ['Book'],
2828
name: ['Business @ the Speed of Thought']
2929
}
3030
]
@@ -41,11 +41,11 @@ describe('Claim', () => {
4141
})
4242
).toEqual({
4343
...claimTemplate,
44-
'@type': 'Claim',
44+
'@type': ['Claim'],
4545
claimInterpreter: [
4646
{
4747
...projectTemplate,
48-
'@type': 'Project',
48+
'@type': ['Project'],
4949
slogan: ['Empower every person and every organization on the planet to achieve more.']
5050
}
5151
]
@@ -60,7 +60,7 @@ describe('Claim', () => {
6060
})
6161
).toEqual({
6262
...claimTemplate,
63-
'@type': 'Claim',
63+
'@type': ['Claim'],
6464
position: [1]
6565
}));
6666

@@ -72,7 +72,7 @@ describe('Claim', () => {
7272
})
7373
).toEqual({
7474
...claimTemplate,
75-
'@type': 'Claim',
75+
'@type': ['Claim'],
7676
position: ['First']
7777
}));
7878
});

packages/core-json-ld/src/orgSchema/Claim.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { intersect, lazy, object, parser, type GenericSchema } from 'valibot';
2-
import { creativeWorkSchema, type CreativeWorkInput, type CreativeWorkOutput } from './CreativeWork.js';
3-
import { projectSchema, type ProjectInput, type ProjectOutput } from './Project.js';
4-
import jsonLinkedDataProperty from '../private/jsonLinkedDataProperty.js';
2+
import { creativeWorkSchema, type CreativeWorkInput, type CreativeWorkOutput } from './CreativeWork';
3+
import { projectSchema, type ProjectInput, type ProjectOutput } from './Project';
4+
import jsonLinkedDataProperty from '../private/jsonLinkedDataProperty';
55

66
/**
77
* A [Claim](https://schema.org/Claim) in Schema.org represents a specific, factually-oriented claim that could be the [itemReviewed](https://schema.org/itemReviewed) in a [ClaimReview](https://schema.org/ClaimReview). The content of a claim can be summarized with the [text](https://schema.org/text) property. Variations on well known claims can have their common identity indicated via [sameAs](https://schema.org/sameAs) links, and summarized with a name. Ideally, a [Claim](https://schema.org/Claim) description includes enough contextual information to minimize the risk of ambiguity or inclarity. In practice, many claims are better understood in the context in which they appear or the interpretations provided by claim reviews.

packages/core-json-ld/src/orgSchema/CreativeWork.parseCreativeWork.spec.ts

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { describe, expect, test } from '@jest/globals';
22
import { parse } from 'valibot';
3-
import { claimSchema } from './Claim.js';
4-
import { creativeWorkSchema, parseCreativeWork } from './CreativeWork.js';
3+
import { claimSchema } from './Claim';
4+
import { creativeWorkSchema, parseCreativeWork } from './CreativeWork';
55

66
const claimTemplate = parse(claimSchema, {});
77
const creativeWorkTemplate = parse(creativeWorkSchema, {});
@@ -15,7 +15,7 @@ describe('CreativeWork', () => {
1515
})
1616
).toEqual({
1717
...creativeWorkTemplate,
18-
'@type': 'CreativeWork',
18+
'@type': ['CreativeWork'],
1919
name: ['Business @ the Speed of Thought']
2020
}));
2121

@@ -27,7 +27,7 @@ describe('CreativeWork', () => {
2727
})
2828
).toEqual({
2929
...creativeWorkTemplate,
30-
'@type': 'Book',
30+
'@type': ['Book'],
3131
name: ['Business @ the Speed of Thought']
3232
}));
3333

@@ -36,16 +36,19 @@ describe('CreativeWork', () => {
3636
parseCreativeWork({
3737
'@type': 'Book',
3838
name: 'Business @ the Speed of Thought',
39-
citation: { '@type': 'Book', name: 'The Road Ahead' }
39+
citation: {
40+
'@type': 'Book',
41+
name: 'The Road Ahead'
42+
}
4043
})
4144
).toEqual({
4245
...creativeWorkTemplate,
43-
'@type': 'Book',
46+
'@type': ['Book'],
4447
name: ['Business @ the Speed of Thought'],
4548
citation: [
4649
{
4750
...claimTemplate,
48-
'@type': 'Book',
51+
'@type': ['Book'],
4952
name: ['The Road Ahead']
5053
}
5154
]
@@ -56,16 +59,21 @@ describe('CreativeWork', () => {
5659
parseCreativeWork({
5760
'@type': 'Book',
5861
name: 'Business @ the Speed of Thought',
59-
citation: [{ '@type': 'Book', name: 'The Road Ahead' }]
62+
citation: [
63+
{
64+
'@type': 'Book',
65+
name: 'The Road Ahead'
66+
}
67+
]
6068
})
6169
).toEqual({
6270
...creativeWorkTemplate,
63-
'@type': 'Book',
71+
'@type': ['Book'],
6472
name: ['Business @ the Speed of Thought'],
6573
citation: [
6674
{
6775
...claimTemplate,
68-
'@type': 'Book',
76+
'@type': ['Book'],
6977
name: ['The Road Ahead']
7078
}
7179
]

packages/core-json-ld/src/orgSchema/CreativeWork.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
import { intersect, lazy, number, object, parser, string, union, type GenericSchema } from 'valibot';
2-
import { claimSchema } from './Claim.js';
2+
import { claimSchema } from './Claim';
33
import {
44
creativeWorkStatusSchema,
55
type CreativeWorkStatusInput,
66
type CreativeWorkStatusOutput
7-
} from './CreativeWorkStatus.js';
8-
import { definedTermSchema, type DefinedTermInput, type DefinedTermOutput } from './DefinedTerm.js';
9-
import { personSchema, type PersonInput, type PersonOutput } from './Person.js';
10-
import jsonLinkedDataProperty from '../private/jsonLinkedDataProperty.js';
7+
} from './CreativeWorkStatus';
8+
import { definedTermSchema, type DefinedTermInput, type DefinedTermOutput } from './DefinedTerm';
9+
import { personSchema, type PersonInput, type PersonOutput } from './Person';
10+
import jsonLinkedDataProperty from '../private/jsonLinkedDataProperty';
1111
import {
1212
softwareSourceCodeSchema,
1313
type SoftwareSourceCodeInput,
1414
type SoftwareSourceCodeOutput
15-
} from './SoftwareSourceCode.js';
16-
import { thingSchema, type ThingInput, type ThingOutput } from './Thing.js';
15+
} from './SoftwareSourceCode';
16+
import { thingSchema, type ThingInput, type ThingOutput } from './Thing';
1717

1818
/**
1919
* The most generic kind of creative work, including books, movies, photographs, software programs, etc.

packages/core-json-ld/src/orgSchema/DefinedTerm.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { intersect, lazy, object, parser, string, type GenericSchema } from 'valibot';
2-
import { thingSchema, type ThingInput, type ThingOutput } from './Thing.js';
3-
import jsonLinkedDataProperty from '../private/jsonLinkedDataProperty.js';
2+
import { thingSchema, type ThingInput, type ThingOutput } from './Thing';
3+
import jsonLinkedDataProperty from '../private/jsonLinkedDataProperty';
44

55
/**
66
* A word, name, acronym, phrase, etc. with a formal definition. Often used in the context of category or subject classification, glossaries or dictionaries, product or creative work types, etc. Use the name property for the term being defined, use termCode if the term has an alpha-numeric code allocated, use description to provide the definition of the term.

packages/core-json-ld/src/orgSchema/Person.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { intersect, lazy, object, parser, string, type GenericSchema } from 'valibot';
2-
import { thingSchema, type ThingInput, type ThingOutput } from './Thing.js';
3-
import jsonLinkedDataProperty from '../private/jsonLinkedDataProperty.js';
2+
import { thingSchema, type ThingInput, type ThingOutput } from './Thing';
3+
import jsonLinkedDataProperty from '../private/jsonLinkedDataProperty';
44

55
/**
66
* A person (alive, dead, undead, or fictional).

packages/core-json-ld/src/orgSchema/Project.parseProject.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { describe, expect, test } from '@jest/globals';
22
import { parse } from 'valibot';
3-
import { parseProject, projectSchema } from './Project.js';
3+
import { parseProject, projectSchema } from './Project';
44

55
const projectTemplate = parse(projectSchema, {});
66

@@ -14,7 +14,7 @@ describe('Project', () => {
1414
})
1515
).toEqual({
1616
...projectTemplate,
17-
'@type': 'Project',
17+
'@type': ['Project'],
1818
name: ['Microsoft'],
1919
slogan: ['Empower every person and every organization on the planet to achieve more.']
2020
});

packages/core-json-ld/src/orgSchema/Project.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { intersect, lazy, object, parser, string, type GenericSchema } from 'valibot';
2-
import jsonLinkedDataProperty from '../private/jsonLinkedDataProperty.js';
3-
import { thingSchema, type ThingInput, type ThingOutput } from './Thing.js';
2+
import jsonLinkedDataProperty from '../private/jsonLinkedDataProperty';
3+
import { thingSchema, type ThingInput, type ThingOutput } from './Thing';
44

55
/**
66
* An enterprise (potentially individual but typically collaborative), planned to achieve a particular aim. Use properties from [Organization](https://schema.org/Organization), [subOrganization](https://schema.org/subOrganization)/[parentOrganization](https://schema.org/parentOrganization) to indicate project sub-structures.

0 commit comments

Comments
 (0)