Skip to content

Commit

Permalink
fix: add new missing properties mocks (id, is_master) (#24)
Browse files Browse the repository at this point in the history
* feat: add missing `id` in asset mocks

* fix: add missing `is_master` property on repository mock

---------

Co-authored-by: lihbr <[email protected]>
  • Loading branch information
lihbr and lihbr authored Sep 4, 2024
1 parent 554157d commit 162a348
Show file tree
Hide file tree
Showing 60 changed files with 80 additions and 60 deletions.
1 change: 1 addition & 0 deletions src/api/repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export const repository = (
{
id: faker.word(),
name: changeCase.capitalCase(faker.word()),
is_master: true,
},
],
tags: generateTags({
Expand Down
2 changes: 2 additions & 0 deletions src/lib/buildImageFieldImage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export const buildImageFieldImage = <
): prismic.ImageFieldImage<State> => {
if (config.state === "empty") {
return {
id: null,
url: null,
dimensions: null,
alt: null,
Expand All @@ -51,6 +52,7 @@ export const buildImageFieldImage = <
url.searchParams.set("fit", "crop");

return {
id: faker.hash(11),
url: url.toString(),
dimensions,
alt: changeCase.sentenceCase(faker.words(faker.range(5, 15))),
Expand Down
1 change: 1 addition & 0 deletions src/value/linkToMedia.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export const linkToMedia = <
} else {
return {
link_type: prismic.LinkType.Media,
id: faker.hash(11),
name: `${changeCase.snakeCase(faker.words(faker.range(1, 2)))}.example`,
kind: changeCase.snakeCase(faker.word()),
url: faker.url(),
Expand Down
Binary file modified test/snapshots/api-query.test.ts.snap
Binary file not shown.
Binary file modified test/snapshots/api-ref.test.ts.snap
Binary file not shown.
4 changes: 4 additions & 0 deletions test/snapshots/api-repository.test.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Generated by [AVA](https://avajs.dev).
languages: [
{
id: 'est',
is_master: true,
name: 'Malesuada',
},
],
Expand Down Expand Up @@ -46,6 +47,7 @@ Generated by [AVA](https://avajs.dev).
languages: [
{
id: 'est',
is_master: true,
name: 'Malesuada',
},
],
Expand Down Expand Up @@ -82,6 +84,7 @@ Generated by [AVA](https://avajs.dev).
languages: [
{
id: 'vel',
is_master: true,
name: 'Ultrices',
},
],
Expand Down Expand Up @@ -111,6 +114,7 @@ Generated by [AVA](https://avajs.dev).
languages: [
{
id: 'vel',
is_master: true,
name: 'Ultrices',
},
],
Expand Down
Binary file modified test/snapshots/api-repository.test.ts.snap
Binary file not shown.
Binary file modified test/snapshots/api-tags.test.ts.snap
Binary file not shown.
Binary file modified test/snapshots/lib-buildMockGroupFieldMap.test.ts.snap
Binary file not shown.
Binary file modified test/snapshots/model-boolean.test.ts.snap
Binary file not shown.
Binary file modified test/snapshots/model-color.test.ts.snap
Binary file not shown.
Binary file modified test/snapshots/model-contentRelationship.test.ts.snap
Binary file not shown.
Binary file modified test/snapshots/model-customType.test.ts.snap
Binary file not shown.
Binary file modified test/snapshots/model-date.test.ts.snap
Binary file not shown.
Binary file modified test/snapshots/model-embed.test.ts.snap
Binary file not shown.
Binary file modified test/snapshots/model-geoPoint.test.ts.snap
Binary file not shown.
Binary file modified test/snapshots/model-group.test.ts.snap
Binary file not shown.
Binary file modified test/snapshots/model-image.test.ts.snap
Binary file not shown.
Binary file modified test/snapshots/model-integration.test.ts.snap
Binary file not shown.
Binary file modified test/snapshots/model-keyText.test.ts.snap
Binary file not shown.
Binary file modified test/snapshots/model-link.test.ts.snap
Binary file not shown.
Binary file modified test/snapshots/model-linkToMedia.test.ts.snap
Binary file not shown.
Binary file modified test/snapshots/model-number.test.ts.snap
Binary file not shown.
Binary file modified test/snapshots/model-richText.test.ts.snap
Binary file not shown.
Binary file modified test/snapshots/model-select.test.ts.snap
Binary file not shown.
Binary file modified test/snapshots/model-sharedSlice.test.ts.snap
Binary file not shown.
Binary file modified test/snapshots/model-sharedSliceChoice.test.ts.snap
Binary file not shown.
Binary file modified test/snapshots/model-sharedSliceVariation.test.ts.snap
Binary file not shown.
Binary file modified test/snapshots/model-slice.test.ts.snap
Binary file not shown.
Binary file modified test/snapshots/model-sliceZone.test.ts.snap
Binary file not shown.
Binary file modified test/snapshots/model-timestamp.test.ts.snap
Binary file not shown.
Binary file modified test/snapshots/model-title.test.ts.snap
Binary file not shown.
Binary file modified test/snapshots/model-uid.test.ts.snap
Binary file not shown.
Binary file modified test/snapshots/value-boolean.test.ts.snap
Binary file not shown.
Binary file modified test/snapshots/value-color.test.ts.snap
Binary file not shown.
Binary file modified test/snapshots/value-contentRelationship.test.ts.snap
Binary file not shown.
Binary file modified test/snapshots/value-customType.test.ts.snap
Binary file not shown.
Binary file modified test/snapshots/value-date.test.ts.snap
Binary file not shown.
Binary file modified test/snapshots/value-embed.test.ts.snap
Binary file not shown.
Binary file modified test/snapshots/value-geoPoint.test.ts.snap
Binary file not shown.
Binary file modified test/snapshots/value-group.test.ts.snap
Binary file not shown.
52 changes: 28 additions & 24 deletions test/snapshots/value-image.test.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,33 +10,35 @@ Generated by [AVA](https://avajs.dev).
[
{
alt: 'In vitae turpis massa sed elementum tempus egestas sed',
copyright: 'Adipiscing elit ut aliquam purus sit amet',
alt: 'Etiam dignissim diam quis enim lobortis scelerisque fermentum dui faucibus',
copyright: 'Lectus sit amet est placerat in egestas erat imperdiet sed euismod',
dimensions: {
height: 4253,
width: 6373,
},
edit: {
background: '#8ccdec',
x: -2575,
y: -298,
zoom: 1.365900692848,
background: '#f5b2ae',
x: 2071,
y: -2054,
zoom: 1.3291021141524197,
},
id: '8052f65df7f',
url: 'https://images.unsplash.com/reserve/HgZuGu3gSD6db21T3lxm_San%20Zenone.jpg?w=6373&h=4253&fit=crop',
},
{
alt: 'In vitae turpis massa sed elementum tempus egestas sed',
copyright: 'Adipiscing elit ut aliquam purus sit amet',
alt: 'Etiam dignissim diam quis enim lobortis scelerisque fermentum dui faucibus',
copyright: 'Lectus sit amet est placerat in egestas erat imperdiet sed euismod',
dimensions: {
height: 4253,
width: 6373,
},
edit: {
background: '#8ccdec',
x: -2575,
y: -298,
zoom: 1.365900692848,
background: '#f5b2ae',
x: 2071,
y: -2054,
zoom: 1.3291021141524197,
},
id: '8052f65df7f',
url: 'https://images.unsplash.com/reserve/HgZuGu3gSD6db21T3lxm_San%20Zenone.jpg?w=6373&h=4253&fit=crop',
},
]
Expand All @@ -47,33 +49,35 @@ Generated by [AVA](https://avajs.dev).
[
{
alt: 'Quis eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis rhoncus urna',
copyright: 'Quis auctor elit sed vulputate mi sit amet mauris commodo quis imperdiet massa tincidunt',
alt: 'Maecenas sed enim ut sem viverra aliquet eget sit',
copyright: 'Leo duis ut diam quam nulla porttitor massa id neque aliquam vestibulum',
dimensions: {
height: 3744,
width: 5616,
},
edit: {
background: '#e1d2fe',
x: -1092,
y: 1445,
zoom: 1.2798682074714145,
background: '#6385eb',
x: 1163,
y: -1271,
zoom: 1.155937177631058,
},
id: 'dd98a8a9eba',
url: 'https://images.unsplash.com/photo-1426604966848-d7adac402bff?w=5616&h=3744&fit=crop',
},
{
alt: 'Quis eleifend quam adipiscing vitae proin sagittis nisl rhoncus mattis rhoncus urna',
copyright: 'Quis auctor elit sed vulputate mi sit amet mauris commodo quis imperdiet massa tincidunt',
alt: 'Maecenas sed enim ut sem viverra aliquet eget sit',
copyright: 'Leo duis ut diam quam nulla porttitor massa id neque aliquam vestibulum',
dimensions: {
height: 3744,
width: 5616,
},
edit: {
background: '#e1d2fe',
x: -1092,
y: 1445,
zoom: 1.2798682074714145,
background: '#6385eb',
x: 1163,
y: -1271,
zoom: 1.155937177631058,
},
id: 'dd98a8a9eba',
url: 'https://images.unsplash.com/photo-1426604966848-d7adac402bff?w=5616&h=3744&fit=crop',
},
]
Binary file modified test/snapshots/value-image.test.ts.snap
Binary file not shown.
Binary file modified test/snapshots/value-integration.test.ts.snap
Binary file not shown.
Binary file modified test/snapshots/value-keyText.test.ts.snap
Binary file not shown.
26 changes: 14 additions & 12 deletions test/snapshots/value-link.test.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,24 @@ Generated by [AVA](https://avajs.dev).
[
{
height: '2806',
kind: 'neque',
height: '2427',
id: '27f8fbcfcc8',
kind: 'cras',
link_type: 'Media',
name: 'malesuada.example',
size: '2002',
url: 'https://urna.example',
width: '848',
name: 'ornare.example',
size: '1888',
url: 'https://volutpat.example',
width: '2531',
},
{
height: '2806',
kind: 'neque',
height: '2427',
id: '27f8fbcfcc8',
kind: 'cras',
link_type: 'Media',
name: 'malesuada.example',
size: '2002',
url: 'https://urna.example',
width: '848',
name: 'ornare.example',
size: '1888',
url: 'https://volutpat.example',
width: '2531',
},
]

Expand Down
Binary file modified test/snapshots/value-link.test.ts.snap
Binary file not shown.
52 changes: 28 additions & 24 deletions test/snapshots/value-linkToMedia.test.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,24 @@ Generated by [AVA](https://avajs.dev).
[
{
height: '749',
kind: 'at',
height: '1921',
id: 'f30d96d5ee2',
kind: 'laoreet',
link_type: 'Media',
name: 'posuere.example',
size: '1216',
url: 'https://vel.example',
width: '2326',
name: 'scelerisque.example',
size: '2617',
url: 'https://donec.example',
width: '2593',
},
{
height: '749',
kind: 'at',
height: '1921',
id: 'f30d96d5ee2',
kind: 'laoreet',
link_type: 'Media',
name: 'posuere.example',
size: '1216',
url: 'https://vel.example',
width: '2326',
name: 'scelerisque.example',
size: '2617',
url: 'https://donec.example',
width: '2593',
},
]

Expand All @@ -35,21 +37,23 @@ Generated by [AVA](https://avajs.dev).
[
{
height: '1907',
kind: 'in',
height: '1741',
id: '2dd98a8a9eb',
kind: 'nec',
link_type: 'Media',
name: 'ut.example',
size: '2949',
url: 'https://quis.example',
width: '1263',
name: 'sed.example',
size: '2434',
url: 'https://maecenas.example',
width: '2267',
},
{
height: '1907',
kind: 'in',
height: '1741',
id: '2dd98a8a9eb',
kind: 'nec',
link_type: 'Media',
name: 'ut.example',
size: '2949',
url: 'https://quis.example',
width: '1263',
name: 'sed.example',
size: '2434',
url: 'https://maecenas.example',
width: '2267',
},
]
Binary file modified test/snapshots/value-linkToMedia.test.ts.snap
Binary file not shown.
Binary file modified test/snapshots/value-number.test.ts.snap
Binary file not shown.
Binary file modified test/snapshots/value-richText.test.ts.snap
Binary file not shown.
Binary file modified test/snapshots/value-select.test.ts.snap
Binary file not shown.
Binary file modified test/snapshots/value-sharedSlice.test.ts.snap
Binary file not shown.
Binary file modified test/snapshots/value-sharedSliceVariation.test.ts.snap
Binary file not shown.
Binary file modified test/snapshots/value-slice.test.ts.snap
Binary file not shown.
Binary file modified test/snapshots/value-sliceZone.test.ts.snap
Binary file not shown.
Binary file modified test/snapshots/value-timestamp.test.ts.snap
Binary file not shown.
Binary file modified test/snapshots/value-title.test.ts.snap
Binary file not shown.
Binary file modified test/snapshots/value-uid.test.ts.snap
Binary file not shown.
2 changes: 2 additions & 0 deletions test/value-image.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,13 @@ test("can be configured to return an empty value", (t) => {
});

t.deepEqual(actual, {
id: null,
url: null,
alt: null,
copyright: null,
dimensions: null,
Foo: {
id: null,
url: null,
alt: null,
copyright: null,
Expand Down

0 comments on commit 162a348

Please sign in to comment.