Skip to content

Commit

Permalink
chore: fix tests for Node v22/23
Browse files Browse the repository at this point in the history
  • Loading branch information
Jon Carlson committed Jan 23, 2025
1 parent 34c6ad2 commit 74091e6
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 25 deletions.
12 changes: 4 additions & 8 deletions packages/app/comments/__tests__/comments.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,17 +100,15 @@ describe('Comments Service', () => {
{} as any // force logged out
)

expect(error).toMatchInlineSnapshot(
`[AssertionError: UnauthorizedError: Unauthorized]`
)
expect(error).toMatchInlineSnapshot(`[UnauthorizedError: Unauthorized]`)
expect(comment).toBeNull()
})

it('returns a list of validation errors if the comment is invalid', async () => {
const [error, comment] = await createCommentAsUser({} as any, BaconUser)

expect(error).toMatchInlineSnapshot(`
[AssertionError: BadRequestError: 0: instance requires property "documentId"
[BadRequestError: 0: instance requires property "documentId"
1: instance requires property "model"
2: instance requires property "text"
]
Expand Down Expand Up @@ -181,17 +179,15 @@ describe('Comments Service', () => {
{} as any // force logged out
)

expect(error).toMatchInlineSnapshot(
`[AssertionError: UnauthorizedError: Unauthorized]`
)
expect(error).toMatchInlineSnapshot(`[UnauthorizedError: Unauthorized]`)
expect(comment).toBeNull()
})

it('returns a list of validation errors if the comment updates are invalid', async () => {
const [error, comment] = await updateCommentAsUser({} as any, BaconUser)

expect(error).toMatchInlineSnapshot(`
[AssertionError: BadRequestError: 0: instance is not any of [subschema 0],[subschema 1]
[BadRequestError: 0: instance is not any of [subschema 0],[subschema 1]
]
`)
expect(comment).toBeNull()
Expand Down
26 changes: 13 additions & 13 deletions packages/app/documents/__tests__/document.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ describe('Documents', () => {
const [error] = await createDocument(document, modelName, user, 'Foo')

expect(error).toMatchInlineSnapshot(
`[AssertionError: BadRequestError: The passed in state, Foo, does not exist]`
`[BadRequestError: The passed in state, Foo, does not exist]`
)
})

Expand All @@ -301,7 +301,7 @@ describe('Documents', () => {
)

expect(error).toMatchInlineSnapshot(
`[AssertionError: BadRequestError: The passed in state, Published, is not an initial node in the workflow]`
`[BadRequestError: The passed in state, Published, is not an initial node in the workflow]`
)
})
})
Expand Down Expand Up @@ -847,7 +847,7 @@ describe('Documents', () => {
user_noFAQRole
)
expect(error).toMatchInlineSnapshot(
`[AssertionError: NotFoundError: Model not found: Eggs]`
`[NotFoundError: Model not found: Eggs]`
)
expect(document).toBeNull()
})
Expand All @@ -860,7 +860,7 @@ describe('Documents', () => {
user_noFAQRole
)
expect(error).toMatchInlineSnapshot(
`[AssertionError: NotFoundError: Requested document, Bacon, in model, FAQs, was not found]`
`[NotFoundError: Requested document, Bacon, in model, FAQs, was not found]`
)
expect(document).toBeNull()
})
Expand All @@ -872,7 +872,7 @@ describe('Documents', () => {
'FAQs'
)
expect(error).toMatchInlineSnapshot(
`[AssertionError: BadRequestError: No state provided]`
`[BadRequestError: No state provided]`
)
expect(document).toBeNull()
})
Expand All @@ -885,7 +885,7 @@ describe('Documents', () => {
user_noFAQRole
)
expect(error).toMatchInlineSnapshot(
`[AssertionError: BadRequestError: Cannot transition to state [Draft] as the document is in this state already]`
`[BadRequestError: Cannot transition to state [Draft] as the document is in this state already]`
)
expect(document).toBeNull()
})
Expand All @@ -898,7 +898,7 @@ describe('Documents', () => {
user_noFAQRole
)
expect(error).toMatchInlineSnapshot(
`[AssertionError: BadRequestError: Cannot transition to state [Foo] as it is not a valid state in the workflow]`
`[BadRequestError: Cannot transition to state [Foo] as it is not a valid state in the workflow]`
)
expect(document).toBeNull()
})
Expand All @@ -911,7 +911,7 @@ describe('Documents', () => {
user_noFAQRole
)
expect(error).toMatchInlineSnapshot(
`[AssertionError: BadRequestError: User does not have the permissions to transition to state Under Review.]`
`[BadRequestError: User does not have the permissions to transition to state Under Review.]`
)
expect(document).toBeNull()
})
Expand Down Expand Up @@ -949,7 +949,7 @@ describe('Documents', () => {
)

expect(error).toMatchInlineSnapshot(
`[AssertionError: BadRequestError: User does not have the permissions to transition to state Approved.]`
`[BadRequestError: User does not have the permissions to transition to state Approved.]`
)
expect(document).toBeNull()
})
Expand All @@ -972,7 +972,7 @@ describe('Documents', () => {

expect(document).toBeNull()
expect(error).toMatchInlineSnapshot(
`[AssertionError: InternalServerError: Workflow, Duplicate Edges, is misconfigured! There are duplicate edges from 'Draft' to 'Under Review'.]`
`[InternalServerError: Workflow, Duplicate Edges, is misconfigured! There are duplicate edges from 'Draft' to 'Under Review'.]`
)
})

Expand Down Expand Up @@ -1170,7 +1170,7 @@ describe('Documents', () => {
const [error, document] = await cloneDocument('Bacon', 'Eggs', 'FAQs')

expect(error).toMatchInlineSnapshot(
`[AssertionError: UnauthorizedError: User is not authenticated]`
`[UnauthorizedError: User is not authenticated]`
)
expect(document).toBeNull()
})
Expand All @@ -1184,7 +1184,7 @@ describe('Documents', () => {
)

expect(error).toMatchInlineSnapshot(
`[AssertionError: NotFoundError: Requested document, Bacon, in model, FAQs, was not found]`
`[NotFoundError: Requested document, Bacon, in model, FAQs, was not found]`
)
expect(document).toBeNull()
})
Expand All @@ -1198,7 +1198,7 @@ describe('Documents', () => {
)

expect(error).toMatchInlineSnapshot(
`[AssertionError: BadRequestError: A document already exists with the title: 'Where do I?']`
`[BadRequestError: A document already exists with the title: 'Where do I?']`
)
expect(document).toBeNull()
})
Expand Down
4 changes: 2 additions & 2 deletions packages/app/models/__tests__/model.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,15 @@ describe('Model', () => {

expect(model).toBeNull()
expect(error).toMatchInlineSnapshot(
`[AssertionError: BadRequestError: Model name is required]`
`[BadRequestError: Model name is required]`
)
})

it('should return an error for a model that does not exist', async () => {
const [error, model] = await getModel('Foo')

expect(error).toMatchInlineSnapshot(
`[AssertionError: NotFoundError: Model not found: Foo]`
`[NotFoundError: Model not found: Foo]`
)
expect(model).toBeNull()
})
Expand Down
4 changes: 2 additions & 2 deletions packages/app/workflows/__tests__/workflow.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ describe('Workflows', () => {
const [error, workflow] = await getWorkflow('Foo')

expect(error).toMatchInlineSnapshot(
`[AssertionError: NotFoundError: The requested workflow, Foo, was not found.]`
`[NotFoundError: The requested workflow, Foo, was not found.]`
)
expect(workflow).toBeNull()
})
Expand Down Expand Up @@ -131,7 +131,7 @@ describe('Workflows', () => {
'Published'
)
}).toThrowErrorMatchingInlineSnapshot(
`"InternalServerError: The workflow, Bacon Workflow, is misconfigured due to having duplicate edges for [source=Draft, target=Published]."`
`"The workflow, Bacon Workflow, is misconfigured due to having duplicate edges for [source=Draft, target=Published]."`
)
})

Expand Down

0 comments on commit 74091e6

Please sign in to comment.