UNPKG

@haechi-labs/henesis-cli

Version:

šŸš€ Command Line Interface tool to Utilize henesis

50 lines • 1.87 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const tslib_1 = require("tslib"); const test_1 = require("@oclif/test"); const utils = tslib_1.__importStar(require("../utils")); const configstore_1 = tslib_1.__importDefault(require("../common/configstore")); describe('login', () => { test_1.test .nock('http://localhost:8080', (api) => api.post('/users/v1/login').reply(200, { email: 'yoonsung@haechi.io', name: 'ys.choi', organization: 'haechilabs', jwtToken: 'asdf', id: 43, })) .stub(utils, 'confirmPrompt', async () => { return Promise.resolve(true); }) .stub(utils, 'emailPrompt', async () => { return Promise.resolve('yoonsung@haechi.io'); }) .stub(utils, 'passwordPrompt', async () => { return Promise.resolve('Ethereum'); }) .stdout() .command(['login']) .it('should be success login with message', (ctx) => { test_1.expect(ctx.stdout).to.equal('Allow Henesis to collect CLI usage and error reporting information\nšŸŽ‰ Login Success from yoonsung@haechi.io šŸŽ‰\n'); }); test_1.test .stub(utils, 'confirmPrompt', async () => { return Promise.resolve(true); }) .stub(utils, 'emailPrompt', async () => { return Promise.resolve('yoonsung@haechi.io'); }) .stub(utils, 'passwordPrompt', async () => { return Promise.resolve('Ethereum'); }) .stdout() .command(['login']) .it('should be already login with message', (ctx) => { test_1.expect(ctx.stdout).to.equal('You are already logged in as yoonsung@haechi.io\n'); }); after(() => { configstore_1.default.delete('user'); configstore_1.default.delete('analytics'); }); }); //# sourceMappingURL=login.spec.js.map