Skip to content

Commit 50f06b4

Browse files
authored
msw/tests: Use @ts-expect-error for expected type errors (#12541)
1 parent 12e0f41 commit 50f06b4

File tree

7 files changed

+10
-0
lines changed

7 files changed

+10
-0
lines changed

packages/crates-io-msw/models/api-token.test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { test } from 'vitest';
33
import { db } from '../index.js';
44

55
test('throws if `user` is not set', async ({ expect }) => {
6+
// @ts-expect-error
67
await expect(() => db.apiToken.create({})).rejects.toThrowErrorMatchingInlineSnapshot(
78
`[Error: Failed to create a new record with initial values: does not match the schema. Please see the schema validation errors above.]`,
89
);

packages/crates-io-msw/models/crate-owner-invitation.test.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { db } from '../index.js';
55
test('throws if `crate` is not set', async ({ expect }) => {
66
let inviter = await db.user.create({});
77
let invitee = await db.user.create({});
8+
// @ts-expect-error
89
await expect(() => db.crateOwnerInvitation.create({ inviter, invitee })).rejects.toThrowErrorMatchingInlineSnapshot(
910
`[Error: Failed to create a new record with initial values: does not match the schema. Please see the schema validation errors above.]`,
1011
);
@@ -13,6 +14,7 @@ test('throws if `crate` is not set', async ({ expect }) => {
1314
test('throws if `inviter` is not set', async ({ expect }) => {
1415
let crate = await db.crate.create({});
1516
let invitee = await db.user.create({});
17+
// @ts-expect-error
1618
await expect(() => db.crateOwnerInvitation.create({ crate, invitee })).rejects.toThrowErrorMatchingInlineSnapshot(
1719
`[Error: Failed to create a new record with initial values: does not match the schema. Please see the schema validation errors above.]`,
1820
);
@@ -21,6 +23,7 @@ test('throws if `inviter` is not set', async ({ expect }) => {
2123
test('throws if `invitee` is not set', async ({ expect }) => {
2224
let crate = await db.crate.create({});
2325
let inviter = await db.user.create({});
26+
// @ts-expect-error
2427
await expect(() => db.crateOwnerInvitation.create({ crate, inviter })).rejects.toThrowErrorMatchingInlineSnapshot(
2528
`[Error: Failed to create a new record with initial values: does not match the schema. Please see the schema validation errors above.]`,
2629
);

packages/crates-io-msw/models/crate-ownership.test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { db } from '../index.js';
44

55
test('throws if `crate` is not set', async ({ expect }) => {
66
let user = await db.user.create({});
7+
// @ts-expect-error
78
await expect(() => db.crateOwnership.create({ user })).rejects.toThrowErrorMatchingInlineSnapshot(
89
`[Error: Failed to create a new record with initial values: does not match the schema. Please see the schema validation errors above.]`,
910
);

packages/crates-io-msw/models/dependency.test.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,15 @@ import { db } from '../index.js';
44

55
test('throws if `crate` is not set', async ({ expect }) => {
66
let version = await db.version.create({ crate: await db.crate.create({}) });
7+
// @ts-expect-error
78
await expect(() => db.dependency.create({ version })).rejects.toThrowErrorMatchingInlineSnapshot(
89
`[Error: Failed to create a new record with initial values: does not match the schema. Please see the schema validation errors above.]`,
910
);
1011
});
1112

1213
test('throws if `version` is not set', async ({ expect }) => {
1314
let crate = await db.crate.create({});
15+
// @ts-expect-error
1416
await expect(() => db.dependency.create({ crate })).rejects.toThrowErrorMatchingInlineSnapshot(
1517
`[Error: Failed to create a new record with initial values: does not match the schema. Please see the schema validation errors above.]`,
1618
);

packages/crates-io-msw/models/msw-session.test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { test } from 'vitest';
33
import { db } from '../index.js';
44

55
test('throws if `user` is not set', async ({ expect }) => {
6+
// @ts-expect-error
67
await expect(() => db.mswSession.create({})).rejects.toThrowErrorMatchingInlineSnapshot(
78
`[Error: Failed to create a new record with initial values: does not match the schema. Please see the schema validation errors above.]`,
89
);

packages/crates-io-msw/models/version-download.test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { test } from 'vitest';
33
import { db } from '../index.js';
44

55
test('throws if `version` is not set', async ({ expect }) => {
6+
// @ts-expect-error
67
await expect(() => db.versionDownload.create({})).rejects.toThrowErrorMatchingInlineSnapshot(
78
`[Error: Failed to create a new record with initial values: does not match the schema. Please see the schema validation errors above.]`,
89
);

packages/crates-io-msw/models/version.test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { test } from 'vitest';
33
import { db } from '../index.js';
44

55
test('throws if `crate` is not set', async ({ expect }) => {
6+
// @ts-expect-error
67
await expect(() => db.version.create({})).rejects.toThrowErrorMatchingInlineSnapshot(
78
`[Error: Failed to create a new record with initial values: does not match the schema. Please see the schema validation errors above.]`,
89
);

0 commit comments

Comments
 (0)