Skip to content

Commit

Permalink
test: remove unused tsdocs
Browse files Browse the repository at this point in the history
  • Loading branch information
lihbr committed Sep 4, 2024
1 parent c27ed42 commit d2cf531
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 70 deletions.
14 changes: 2 additions & 12 deletions test/helpers-isFilled.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,7 @@ it("image", (ctx) => {
expect(isFilled.image(null)).toBe(false)
expect(isFilled.image(undefined)).toBe(false)
expect(isFilled.image({})).toBe(false)
expect(
isFilled.image(
// @ts-expect-error Remove this comment after v7.3.0 is published.
ctx.mock.value.image(),
),
).toBe(true)
expect(isFilled.image(ctx.mock.value.image())).toBe(true)

Check failure on line 64 in test/helpers-isFilled.test.ts

View workflow job for this annotation

GitHub Actions / Types (ubuntu-latest, Node 22, TS 5.2)

Argument of type 'Simplify<FilledImageFieldImage & Record<string, FilledImageFieldImage>>' is not assignable to parameter of type 'ImageField<never> | null | undefined'.

Check failure on line 64 in test/helpers-isFilled.test.ts

View workflow job for this annotation

GitHub Actions / Types (ubuntu-latest, Node 22, TS 5.3)

Argument of type 'Simplify<FilledImageFieldImage & Record<string, FilledImageFieldImage>>' is not assignable to parameter of type 'ImageField<never> | null | undefined'.

Check failure on line 64 in test/helpers-isFilled.test.ts

View workflow job for this annotation

GitHub Actions / Types (ubuntu-latest, Node 22, TS 5.4)

Argument of type 'Simplify<FilledImageFieldImage & Record<string, FilledImageFieldImage>>' is not assignable to parameter of type 'ImageField<never> | null | undefined'.

Check failure on line 64 in test/helpers-isFilled.test.ts

View workflow job for this annotation

GitHub Actions / Types (ubuntu-latest, Node 22, TS 5.5)

Argument of type 'Simplify<FilledImageFieldImage & Record<string, FilledImageFieldImage>>' is not assignable to parameter of type 'ImageField<never> | null | undefined'.
})

it("image thumbnail", () => {
Expand Down Expand Up @@ -137,12 +132,7 @@ it("rich text", (ctx) => {
expect(isFilled.richText([{ type: "paragraph", text: "", spans: [] }])).toBe(
false,
)
expect(
isFilled.richText(
// @ts-expect-error Remove this comment after v7.3.0 is published.
ctx.mock.value.richText(),
),
).toBe(true)
expect(isFilled.richText(ctx.mock.value.richText())).toBe(true)

Check failure on line 135 in test/helpers-isFilled.test.ts

View workflow job for this annotation

GitHub Actions / Types (ubuntu-latest, Node 22, TS 5.2)

Argument of type '[] | [RTNode, ...RTNode[]]' is not assignable to parameter of type 'RichTextField | null | undefined'.

Check failure on line 135 in test/helpers-isFilled.test.ts

View workflow job for this annotation

GitHub Actions / Types (ubuntu-latest, Node 22, TS 5.3)

Argument of type '[] | [RTNode, ...RTNode[]]' is not assignable to parameter of type 'RichTextField | null | undefined'.

Check failure on line 135 in test/helpers-isFilled.test.ts

View workflow job for this annotation

GitHub Actions / Types (ubuntu-latest, Node 22, TS 5.4)

Argument of type '[] | [RTNode, ...RTNode[]]' is not assignable to parameter of type 'RichTextField | null | undefined'.

Check failure on line 135 in test/helpers-isFilled.test.ts

View workflow job for this annotation

GitHub Actions / Types (ubuntu-latest, Node 22, TS 5.5)

Argument of type '[] | [RTNode, ...RTNode[]]' is not assignable to parameter of type 'RichTextField | null | undefined'.
})

it("select", (ctx) => {
Expand Down
87 changes: 29 additions & 58 deletions test/helpers-mapSliceZone.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,10 @@ const generateTestData = (ctx: TestContext) => {
it("maps a Slice Zone", async (ctx) => {
const { sliceZone, model1, model2 } = generateTestData(ctx)

const actual = await mapSliceZone(
// @ts-expect-error Remove this comment after v7.3.0 is published.
sliceZone,
{
[model1.id]: () => ({ foo: "bar" }),
[model2.id]: () => ({ baz: "qux" }),
},
)
const actual = await mapSliceZone(sliceZone, {

Check failure on line 39 in test/helpers-mapSliceZone.test.ts

View workflow job for this annotation

GitHub Actions / Types (ubuntu-latest, Node 22, TS 5.2)

Argument of type 'SharedSlice[]' is not assignable to parameter of type 'SliceZoneLike<SliceLike<string>>'.

Check failure on line 39 in test/helpers-mapSliceZone.test.ts

View workflow job for this annotation

GitHub Actions / Types (ubuntu-latest, Node 22, TS 5.3)

Argument of type 'SharedSlice[]' is not assignable to parameter of type 'SliceZoneLike<SliceLike<string>>'.

Check failure on line 39 in test/helpers-mapSliceZone.test.ts

View workflow job for this annotation

GitHub Actions / Types (ubuntu-latest, Node 22, TS 5.4)

Argument of type 'SharedSlice[]' is not assignable to parameter of type 'SliceZoneLike<SliceLike<string>>'.

Check failure on line 39 in test/helpers-mapSliceZone.test.ts

View workflow job for this annotation

GitHub Actions / Types (ubuntu-latest, Node 22, TS 5.5)

Argument of type 'SharedSlice[]' is not assignable to parameter of type 'SliceZoneLike<SliceLike<string>>'.
[model1.id]: () => ({ foo: "bar" }),
[model2.id]: () => ({ baz: "qux" }),
})

expect(actual).toStrictEqual([
{ __mapped: true, id: undefined, slice_type: model1.id, foo: "bar" },
Expand All @@ -54,14 +50,10 @@ it("maps a Slice Zone", async (ctx) => {
it("supports mapping functions that return undefined", async (ctx) => {
const { sliceZone, model1, model2 } = generateTestData(ctx)

const actual = await mapSliceZone(
// @ts-expect-error Remove this comment after v7.3.0 is published.
sliceZone,
{
[model1.id]: () => void 0,
[model2.id]: () => void 0,
},
)
const actual = await mapSliceZone(sliceZone, {

Check failure on line 53 in test/helpers-mapSliceZone.test.ts

View workflow job for this annotation

GitHub Actions / Types (ubuntu-latest, Node 22, TS 5.2)

Argument of type 'SharedSlice[]' is not assignable to parameter of type 'SliceZoneLike<SliceLike<string>>'.

Check failure on line 53 in test/helpers-mapSliceZone.test.ts

View workflow job for this annotation

GitHub Actions / Types (ubuntu-latest, Node 22, TS 5.3)

Argument of type 'SharedSlice[]' is not assignable to parameter of type 'SliceZoneLike<SliceLike<string>>'.

Check failure on line 53 in test/helpers-mapSliceZone.test.ts

View workflow job for this annotation

GitHub Actions / Types (ubuntu-latest, Node 22, TS 5.4)

Argument of type 'SharedSlice[]' is not assignable to parameter of type 'SliceZoneLike<SliceLike<string>>'.

Check failure on line 53 in test/helpers-mapSliceZone.test.ts

View workflow job for this annotation

GitHub Actions / Types (ubuntu-latest, Node 22, TS 5.5)

Argument of type 'SharedSlice[]' is not assignable to parameter of type 'SliceZoneLike<SliceLike<string>>'.
[model1.id]: () => void 0,
[model2.id]: () => void 0,
})

expect(actual).toStrictEqual([
{ __mapped: true, id: undefined, slice_type: model1.id },
Expand All @@ -72,14 +64,10 @@ it("supports mapping functions that return undefined", async (ctx) => {
it("supports async mapping functions", async (ctx) => {
const { sliceZone, model1, model2 } = generateTestData(ctx)

const actual = await mapSliceZone(
// @ts-expect-error Remove this comment after v7.3.0 is published.
sliceZone,
{
[model1.id]: async () => ({ foo: "bar" }),
[model2.id]: async () => ({ baz: "qux" }),
},
)
const actual = await mapSliceZone(sliceZone, {

Check failure on line 67 in test/helpers-mapSliceZone.test.ts

View workflow job for this annotation

GitHub Actions / Types (ubuntu-latest, Node 22, TS 5.2)

Argument of type 'SharedSlice[]' is not assignable to parameter of type 'SliceZoneLike<SliceLike<string>>'.

Check failure on line 67 in test/helpers-mapSliceZone.test.ts

View workflow job for this annotation

GitHub Actions / Types (ubuntu-latest, Node 22, TS 5.3)

Argument of type 'SharedSlice[]' is not assignable to parameter of type 'SliceZoneLike<SliceLike<string>>'.

Check failure on line 67 in test/helpers-mapSliceZone.test.ts

View workflow job for this annotation

GitHub Actions / Types (ubuntu-latest, Node 22, TS 5.4)

Argument of type 'SharedSlice[]' is not assignable to parameter of type 'SliceZoneLike<SliceLike<string>>'.

Check failure on line 67 in test/helpers-mapSliceZone.test.ts

View workflow job for this annotation

GitHub Actions / Types (ubuntu-latest, Node 22, TS 5.5)

Argument of type 'SharedSlice[]' is not assignable to parameter of type 'SliceZoneLike<SliceLike<string>>'.
[model1.id]: async () => ({ foo: "bar" }),
[model2.id]: async () => ({ baz: "qux" }),
})

expect(actual).toStrictEqual([
{ __mapped: true, id: undefined, slice_type: model1.id, foo: "bar" },
Expand All @@ -90,14 +78,10 @@ it("supports async mapping functions", async (ctx) => {
it("supports overriding id and slice_type properties", async (ctx) => {
const { sliceZone, model1, model2 } = generateTestData(ctx)

const actual = await mapSliceZone(
// @ts-expect-error Remove this comment after v7.3.0 is published.
sliceZone,
{
[model1.id]: async () => ({ id: "foo", slice_type: "bar" }),
[model2.id]: async () => ({ id: "baz", slice_type: "qux" }),
},
)
const actual = await mapSliceZone(sliceZone, {

Check failure on line 81 in test/helpers-mapSliceZone.test.ts

View workflow job for this annotation

GitHub Actions / Types (ubuntu-latest, Node 22, TS 5.2)

Argument of type 'SharedSlice[]' is not assignable to parameter of type 'SliceZoneLike<SliceLike<string>>'.

Check failure on line 81 in test/helpers-mapSliceZone.test.ts

View workflow job for this annotation

GitHub Actions / Types (ubuntu-latest, Node 22, TS 5.3)

Argument of type 'SharedSlice[]' is not assignable to parameter of type 'SliceZoneLike<SliceLike<string>>'.

Check failure on line 81 in test/helpers-mapSliceZone.test.ts

View workflow job for this annotation

GitHub Actions / Types (ubuntu-latest, Node 22, TS 5.4)

Argument of type 'SharedSlice[]' is not assignable to parameter of type 'SliceZoneLike<SliceLike<string>>'.

Check failure on line 81 in test/helpers-mapSliceZone.test.ts

View workflow job for this annotation

GitHub Actions / Types (ubuntu-latest, Node 22, TS 5.5)

Argument of type 'SharedSlice[]' is not assignable to parameter of type 'SliceZoneLike<SliceLike<string>>'.
[model1.id]: async () => ({ id: "foo", slice_type: "bar" }),
[model2.id]: async () => ({ id: "baz", slice_type: "qux" }),
})

expect(actual).toStrictEqual([
{ __mapped: true, id: "foo", slice_type: "bar" },
Expand All @@ -111,14 +95,10 @@ it("provides Slice data to mapping functions", async (ctx) => {
const mapper1 = vi.fn()
const mapper2 = vi.fn()

await mapSliceZone(
// @ts-expect-error Remove this comment after v7.3.0 is published.
sliceZone,
{
[model1.id]: mapper1,
[model2.id]: mapper2,
},
)
await mapSliceZone(sliceZone, {

Check failure on line 98 in test/helpers-mapSliceZone.test.ts

View workflow job for this annotation

GitHub Actions / Types (ubuntu-latest, Node 22, TS 5.2)

Argument of type 'SharedSlice[]' is not assignable to parameter of type 'SliceZoneLike<SliceLike<string>>'.

Check failure on line 98 in test/helpers-mapSliceZone.test.ts

View workflow job for this annotation

GitHub Actions / Types (ubuntu-latest, Node 22, TS 5.3)

Argument of type 'SharedSlice[]' is not assignable to parameter of type 'SliceZoneLike<SliceLike<string>>'.

Check failure on line 98 in test/helpers-mapSliceZone.test.ts

View workflow job for this annotation

GitHub Actions / Types (ubuntu-latest, Node 22, TS 5.4)

Argument of type 'SharedSlice[]' is not assignable to parameter of type 'SliceZoneLike<SliceLike<string>>'.

Check failure on line 98 in test/helpers-mapSliceZone.test.ts

View workflow job for this annotation

GitHub Actions / Types (ubuntu-latest, Node 22, TS 5.5)

Argument of type 'SharedSlice[]' is not assignable to parameter of type 'SliceZoneLike<SliceLike<string>>'.
[model1.id]: mapper1,
[model2.id]: mapper2,
})

expect(mapper1).toHaveBeenCalledWith({
context: undefined,
Expand All @@ -143,7 +123,6 @@ it("supports context", async (ctx) => {
const context = { foo: "bar" }

await mapSliceZone(
// @ts-expect-error Remove this comment after v7.3.0 is published.
sliceZone,

Check failure on line 126 in test/helpers-mapSliceZone.test.ts

View workflow job for this annotation

GitHub Actions / Types (ubuntu-latest, Node 22, TS 5.2)

Argument of type 'SharedSlice[]' is not assignable to parameter of type 'SliceZoneLike<SliceLike<string>>'.

Check failure on line 126 in test/helpers-mapSliceZone.test.ts

View workflow job for this annotation

GitHub Actions / Types (ubuntu-latest, Node 22, TS 5.3)

Argument of type 'SharedSlice[]' is not assignable to parameter of type 'SliceZoneLike<SliceLike<string>>'.

Check failure on line 126 in test/helpers-mapSliceZone.test.ts

View workflow job for this annotation

GitHub Actions / Types (ubuntu-latest, Node 22, TS 5.4)

Argument of type 'SharedSlice[]' is not assignable to parameter of type 'SliceZoneLike<SliceLike<string>>'.

Check failure on line 126 in test/helpers-mapSliceZone.test.ts

View workflow job for this annotation

GitHub Actions / Types (ubuntu-latest, Node 22, TS 5.5)

Argument of type 'SharedSlice[]' is not assignable to parameter of type 'SliceZoneLike<SliceLike<string>>'.
{
[model1.id]: mapper1,
Expand All @@ -169,16 +148,12 @@ it("supports context", async (ctx) => {
it("supports lazy-loaded mapping functions", async (ctx) => {
const { sliceZone, model1, model2 } = generateTestData(ctx)

const actual = await mapSliceZone(
// @ts-expect-error Remove this comment after v7.3.0 is published.
sliceZone,
{
// Simulates `import()` with a named `default` export.
[model1.id]: async () => ({ default: () => ({ foo: "bar" }) }),
// Simulates `import()` with a default export.
[model2.id]: async () => () => ({ baz: "qux" }),
},
)
const actual = await mapSliceZone(sliceZone, {

Check failure on line 151 in test/helpers-mapSliceZone.test.ts

View workflow job for this annotation

GitHub Actions / Types (ubuntu-latest, Node 22, TS 5.2)

Argument of type 'SharedSlice[]' is not assignable to parameter of type 'SliceZoneLike<SliceLike<string>>'.

Check failure on line 151 in test/helpers-mapSliceZone.test.ts

View workflow job for this annotation

GitHub Actions / Types (ubuntu-latest, Node 22, TS 5.3)

Argument of type 'SharedSlice[]' is not assignable to parameter of type 'SliceZoneLike<SliceLike<string>>'.

Check failure on line 151 in test/helpers-mapSliceZone.test.ts

View workflow job for this annotation

GitHub Actions / Types (ubuntu-latest, Node 22, TS 5.4)

Argument of type 'SharedSlice[]' is not assignable to parameter of type 'SliceZoneLike<SliceLike<string>>'.

Check failure on line 151 in test/helpers-mapSliceZone.test.ts

View workflow job for this annotation

GitHub Actions / Types (ubuntu-latest, Node 22, TS 5.5)

Argument of type 'SharedSlice[]' is not assignable to parameter of type 'SliceZoneLike<SliceLike<string>>'.
// Simulates `import()` with a named `default` export.
[model1.id]: async () => ({ default: () => ({ foo: "bar" }) }),
// Simulates `import()` with a default export.
[model2.id]: async () => () => ({ baz: "qux" }),
})

expect(actual).toStrictEqual([
{ __mapped: true, id: undefined, slice_type: model1.id, foo: "bar" },
Expand All @@ -189,13 +164,9 @@ it("supports lazy-loaded mapping functions", async (ctx) => {
it("skips Slices without a mapping function", async (ctx) => {
const { sliceZone, model1 } = generateTestData(ctx)

const actual = await mapSliceZone(
// @ts-expect-error Remove this comment after v7.3.0 is published.
sliceZone,
{
[model1.id]: () => void 0,
},
)
const actual = await mapSliceZone(sliceZone, {

Check failure on line 167 in test/helpers-mapSliceZone.test.ts

View workflow job for this annotation

GitHub Actions / Types (ubuntu-latest, Node 22, TS 5.2)

Argument of type 'SharedSlice[]' is not assignable to parameter of type 'SliceZoneLike<SliceLike<string>>'.

Check failure on line 167 in test/helpers-mapSliceZone.test.ts

View workflow job for this annotation

GitHub Actions / Types (ubuntu-latest, Node 22, TS 5.3)

Argument of type 'SharedSlice[]' is not assignable to parameter of type 'SliceZoneLike<SliceLike<string>>'.

Check failure on line 167 in test/helpers-mapSliceZone.test.ts

View workflow job for this annotation

GitHub Actions / Types (ubuntu-latest, Node 22, TS 5.4)

Argument of type 'SharedSlice[]' is not assignable to parameter of type 'SliceZoneLike<SliceLike<string>>'.

Check failure on line 167 in test/helpers-mapSliceZone.test.ts

View workflow job for this annotation

GitHub Actions / Types (ubuntu-latest, Node 22, TS 5.5)

Argument of type 'SharedSlice[]' is not assignable to parameter of type 'SliceZoneLike<SliceLike<string>>'.
[model1.id]: () => void 0,
})

expect(actual).toStrictEqual([
{ __mapped: true, id: undefined, slice_type: model1.id },
Expand Down

0 comments on commit d2cf531

Please sign in to comment.