Skip to content

Commit

Permalink
test(plugin-flow-builder): add a test to check smart intent Other
Browse files Browse the repository at this point in the history
  • Loading branch information
Iru89 committed May 13, 2024
1 parent 9798e31 commit 32d0c2f
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions packages/botonic-plugin-flow-builder/tests/smart-intent.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,30 @@ describe('Check the contents returned by the plugin when match a smart intent',
)
})
})

describe('Check the contents returned by the plugin when no match a smart intent', () => {
process.env.NODE_ENV = ProcessEnvNodeEnvs.PRODUCTION
const flowBuilderPlugin = createFlowBuilderPlugin(smartIntentsFlow)

beforeEach(() => mockSmartIntent('Other'))

test('When the smart intent inference returns the intent_name Other, fallback content are displayed', async () => {
const request = createRequest({
input: {
data: 'I want to cancel my booking',
type: INPUT.TEXT,
},
plugins: {
// @ts-ignore
flowBuilderPlugin,
},
})

const { contents } = await getContentsAfterPreAndBotonicInit(
request,
flowBuilderPlugin
)

expect((contents[0] as FlowText).text).toBe('fallback 1st message')
})
})

0 comments on commit 32d0c2f

Please sign in to comment.