UNPKG

telesignenterprisesdk

Version:

This SDK enhances the functionality of the Telesign Self-service Node SDK, providing access to a broader range of Telesign APIs. See our source code on GitHub (https://github.com/TeleSign/node_telesign_enterprise) for installation instructions and other d

61 lines (49 loc) 2.25 kB
const { it, expect } = require('./TestFramework.js'); const OmniVerifyClient = require('../src/omniverifyclient.js'); // OmniVerifyClient Tests function omniverifyTest() { const customerId = process.env.CUSTOMER_ID || 'FFFFFFFF-EEEE-DDDD-1234-AB1234567890'; const apiKey = process.env.API_KEY || 'ABC12345yusumoN6BYsBVkh+yRJ5czgsnCehZaOYldPJdmFh6NeX8kunZ2zU1YWaUw/0wV6xfw=='; const phoneNumber = process.env.PHONE_NUMBER || '11234567890'; it('Testing omni verify client createVerificationProcess method', async () => { // Given const sut = new OmniVerifyClient(customerId, apiKey); const actualResponse = await new Promise((resolve) => { // When sut.createVerificationProcess((err, res) => resolve(res), phoneNumber); }); // Then expect(actualResponse.status.code).toEqual(3901); }); it('Testing omni verify client getVerificationProcess method', async () => { // Given const sut = new OmniVerifyClient(customerId, apiKey); const createResponse = await new Promise((resolve) => { sut.createVerificationProcess((err, res) => resolve(res), phoneNumber); }); const getResponse = await new Promise((resolve) => { // When sut.getVerificationProcess((err, res) => resolve(res), createResponse.reference_id); }); // Then expect(getResponse.inner_methods[0].err_code).toEqual(3901); expect(getResponse.inner_methods[0].state).toEqual("ONGOING"); }); it('Testing omni verify client updateVerificationProcess method', async () => { // Given const action = "finalize"; const securityFactor = "121212"; // Invalid code const sut = new OmniVerifyClient(customerId, apiKey); const createResponse = await new Promise((resolve) => { sut.createVerificationProcess((err, res) => resolve(res), phoneNumber); }); const updateResponse = await new Promise((resolve) => { // When sut.updateVerificationProcess((err, res) => resolve(res), createResponse.reference_id, action, securityFactor); }); // Then // We expect Invalid code entered. Verification is in ONGOING state. End user can try again. expect(updateResponse.status.code).toEqual(3909); }); } module.exports = { omniverifyTest };