Skip to content

Commit

Permalink
feat(SHAPE-8085): fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
demetriusfeijoo committed Jan 15, 2025
1 parent d0e8573 commit 11297f8
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ describe('handlePluginMessage', () => {
action: 'prompt-ai',
uid,
callbackId: 'test-callback-id',
output: 'Some output',
aiGeneratedText: 'Some AI generated text',
}

const callbacks = mockCallbacks()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const stub: PromptAIResponseMessage = {
action: 'prompt-ai',
uid: '-preview',
callbackId: 'test-callback-id',
output: 'test-output',
aiGeneratedText: 'test-ai-generated-text',
}

describe('PromptAIResponseMessage', function () {
Expand All @@ -30,50 +30,50 @@ describe('PromptAIResponseMessage', function () {
).toEqual(false)
})
})
describe('the output property', () => {
describe('the aiGeneratedText property', () => {
it('cannot be undefined', () => {
expect(
isPromptAIMessage({
...stub,
output: undefined,
aiGeneratedText: undefined,
}),
).toEqual(false)
})
it('is a string', () => {
expect(
isPromptAIMessage({
...stub,
output: 'any-string',
aiGeneratedText: 'any-string',
}),
).toEqual(true)
expect(
isPromptAIMessage({
...stub,
output: 123,
aiGeneratedText: 123,
}),
).toEqual(false)
expect(
isPromptAIMessage({
...stub,
output: null,
aiGeneratedText: null,
}),
).toEqual(false)
expect(
isPromptAIMessage({
...stub,
output: [],
aiGeneratedText: [],
}),
).toEqual(false)
expect(
isPromptAIMessage({
...stub,
output: {},
aiGeneratedText: {},
}),
).toEqual(false)
expect(
isPromptAIMessage({
...stub,
output: false,
aiGeneratedText: false,
}),
).toEqual(false)
})
Expand Down
3 changes: 2 additions & 1 deletion packages/lib-helpers/test/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ const getContainer = (sendToFieldPlugin: (data: unknown) => void) => {
action: 'prompt-ai',
uid,
callbackId: data.callbackId,
output: 'output fake for the prompt: ' + data.payload.text,
aiGeneratedText:
'Fake AI generated text for the prompt: ' + data.payload.text,
})
} else if (isGetUserContextMessage(data)) {
sendToFieldPlugin({
Expand Down

0 comments on commit 11297f8

Please sign in to comment.