import { prepareEnvironment } from '@gmrchk/cli-testing-library' import { getLastStdoutStringHelper } from './helpers/get-last-stdout-string.helper' describe('Start Storage Node without Cluster Management Notification', () => { it('testing CLI the way they are used', async () => { const { spawn, cleanup } = await prepareEnvironment() const { waitForText, writeText, pressKey, debug, getStdout } = await spawn('ts-node', './src/index.ts') debug() await waitForText('Cerebellum Network DDC onboard tool') await waitForText('correct country of node? (yes|no)') await writeText('no') await pressKey('enter') await waitForText('? Select country of node:') await Promise.all([...Array(30).keys()].map(() => pressKey('arrowDown'))) // Brazil await pressKey('enter') await waitForText('? Please, specify your email address:') await writeText('mytestonboardingtool@cere.io') await pressKey('enter') await waitForText('Setup wallet:') await pressKey('arrowDown') await pressKey('enter') await waitForText('? Enter seed phrase:') await writeText('fly rude such issue joke donor nature pepper place demand finish avoid') await pressKey('enter') await waitForText('? Is this correct address 5Cg2WxQKKpNtzRBA3YFUuuWV9Gqq5B74MbA6fAih2iYqoAEx?') await writeText('yes') await pressKey('enter') await waitForText('? Select network:') // DEVNET await pressKey('arrowDown') await pressKey('arrowDown') await pressKey('enter') await waitForText('? Select node type:') // Storage await pressKey('arrowDown') await pressKey('arrowDown') await pressKey('enter') await waitForText( '? Provide a stake to DDC Staking as a CDN node at \n' + 'https://staking-dev.network-dev.aws.cere.io \n' + 'And enter cluster ID you staked to:', ) await writeText('1') await pressKey('enter') await waitForText('? Use default config?') expect(getLastStdoutStringHelper(getStdout())).toBe('? Use default config? (Y/n)') await writeText('Y') await pressKey('enter') await waitForText('? Set http port') expect(getLastStdoutStringHelper(getStdout())).toBe('? Set http port (8080)') await writeText('8080') await pressKey('enter') await waitForText('? Set path for data storage') await pressKey('enter') await waitForText('? Notify cluster manager about new node?') expect(getLastStdoutStringHelper(getStdout())).toBe('? Notify cluster manager about new node? (Y/n)') await writeText('n') await pressKey('enter') await cleanup() }) })