const test = require("tap").test; const rangi = require("rangi"); const lib = require("../lib"); test("Initial menu, go to help, exit", async (t) => { const sessionId = lib.newSession(); t.plan(3); t.test("Display menu and Sarafu balance", async (t) => { await lib.wait(3000); const r = await lib.ussdClient(sessionId); console.log(rangi.cyan(r.text)); t.equal(r.code, "CON"); t.match(r.text, /Balance/g); t.end(); }); t.test("Go to help menu", async (t) => { await lib.wait(3000); const r = await lib.ussdClient(sessionId, "4"); console.log(rangi.cyan(r.text)); t.equal(r.code, "CON"); t.match(r.text, /assistance/g); t.end(); }); t.test("Exit", async (t) => { await lib.wait(3000); const r = await lib.ussdClient(sessionId, "4*99"); console.log(rangi.cyan(r.text)); t.equal(r.code, "END"); t.match(r.text, /Thank/g); t.end(); }); });