mirror of
https://github.com/leon-ai/leon.git
synced 2024-12-01 03:15:58 +03:00
test(package/trend): Product Hunt module
This commit is contained in:
parent
3779430621
commit
8134310323
@ -8,8 +8,6 @@ describe('trend:github', async () => {
|
||||
const [obj] = global.nlu.brain.execute.mock.calls
|
||||
await global.brain.execute(obj[0])
|
||||
|
||||
console.log(global.brain.finalOutput)
|
||||
|
||||
expect(global.brain.finalOutput.speech.split('</li>').length - 1).toBe(25)
|
||||
expect(global.brain.finalOutput.codes).toIncludeSameMembers([
|
||||
'limit_max',
|
||||
@ -25,8 +23,6 @@ describe('trend:github', async () => {
|
||||
const [obj] = global.nlu.brain.execute.mock.calls
|
||||
await global.brain.execute(obj[0])
|
||||
|
||||
console.log(global.brain.finalOutput)
|
||||
|
||||
expect(global.brain.finalOutput.speech.split('</li>').length - 1).toBe(16)
|
||||
expect(global.brain.finalOutput.codes).toIncludeSameMembers([
|
||||
'reaching',
|
||||
@ -41,8 +37,6 @@ describe('trend:github', async () => {
|
||||
const [obj] = global.nlu.brain.execute.mock.calls
|
||||
await global.brain.execute(obj[0])
|
||||
|
||||
console.log(global.brain.finalOutput)
|
||||
|
||||
expect(global.brain.finalOutput.speech.split('</li>').length - 1).toBe(5)
|
||||
expect(global.brain.finalOutput.codes).toIncludeSameMembers([
|
||||
'reaching',
|
||||
@ -57,8 +51,6 @@ describe('trend:github', async () => {
|
||||
const [obj] = global.nlu.brain.execute.mock.calls
|
||||
await global.brain.execute(obj[0])
|
||||
|
||||
console.log(global.brain.finalOutput)
|
||||
|
||||
expect(global.brain.finalOutput.speech.split('</li>').length - 1).toBe(5)
|
||||
expect(global.brain.finalOutput.codes).toIncludeSameMembers([
|
||||
'reaching',
|
||||
@ -73,8 +65,6 @@ describe('trend:github', async () => {
|
||||
const [obj] = global.nlu.brain.execute.mock.calls
|
||||
await global.brain.execute(obj[0])
|
||||
|
||||
console.log(global.brain.finalOutput)
|
||||
|
||||
expect(global.brain.finalOutput.speech.split('</li>').length - 1).toBe(7)
|
||||
expect(global.brain.finalOutput.speech.indexOf('Python')).not.toBe(-1)
|
||||
expect(global.brain.finalOutput.codes).toIncludeSameMembers([
|
||||
@ -90,8 +80,6 @@ describe('trend:github', async () => {
|
||||
const [obj] = global.nlu.brain.execute.mock.calls
|
||||
await global.brain.execute(obj[0])
|
||||
|
||||
console.log(global.brain.finalOutput)
|
||||
|
||||
expect(global.brain.finalOutput.speech.split('</li>').length - 1).toBe(14)
|
||||
expect(global.brain.finalOutput.speech.indexOf('JavaScript')).not.toBe(-1)
|
||||
expect(global.brain.finalOutput.codes).toIncludeSameMembers([
|
||||
@ -107,8 +95,6 @@ describe('trend:github', async () => {
|
||||
const [obj] = global.nlu.brain.execute.mock.calls
|
||||
await global.brain.execute(obj[0])
|
||||
|
||||
console.log(global.brain.finalOutput)
|
||||
|
||||
expect(global.brain.finalOutput.speech.split('</li>').length - 1).toBe(5)
|
||||
expect(global.brain.finalOutput.speech.indexOf('CSS')).not.toBe(-1)
|
||||
expect(global.brain.finalOutput.codes).toIncludeSameMembers([
|
||||
|
17
packages/trend/test/producthunt.spec.js
Normal file
17
packages/trend/test/producthunt.spec.js
Normal file
@ -0,0 +1,17 @@
|
||||
'use strict'
|
||||
|
||||
describe('trend:producthunt', async () => {
|
||||
test('requests Product Hunt', async () => {
|
||||
global.nlu.brain.execute = jest.fn()
|
||||
await global.nlu.process('What\'s trending on Product Hunt?')
|
||||
|
||||
const [obj] = global.nlu.brain.execute.mock.calls
|
||||
await global.brain.execute(obj[0])
|
||||
|
||||
expect([
|
||||
'reaching',
|
||||
'today',
|
||||
'unreachable'
|
||||
]).toIncludeAnyMembers(global.brain.finalOutput.codes)
|
||||
})
|
||||
})
|
Loading…
Reference in New Issue
Block a user