Last active
April 24, 2019 17:25
-
-
Save pmendonca/5c38c88ec756415d9da441100cc8ea60 to your computer and use it in GitHub Desktop.
Twilio Jest Mock
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const mockConferences = () => ({ | |
participants: () => ( | |
{ update: () => Promise.resolve({}) } | |
) | |
}) | |
mockConferences.list = () => Promise.resolve([]) | |
module.exports = class Twilio { | |
constructor (sid, token) { | |
this.calls = { | |
create: () => Promise.resolve({ foo: 'bar' }), | |
list: () => Promise.resolve([{ sid: '123' }]) | |
} | |
this.conferences = mockConferences | |
this.taskrouter = { | |
workspaces: () => { | |
return { | |
workers: { | |
list: () => [{ attributes: '{}' }] | |
}, | |
tasks: () => ({ | |
fetch: () => ({ attributes: '' }) | |
}) | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment