forked from yobinmok/stackoverflow-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.js
More file actions
32 lines (26 loc) · 1.08 KB
/
Copy pathtest.js
File metadata and controls
32 lines (26 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
const cli = require('./utils/cli');
const output = require('./utils/output');
const save = require('./utils/save')
const browser = require('./utils/browser')
test('CLI function should return undefined', async () => {
const cliPrompt = await cli('how to sort a list in python', []);
expect(typeof cliPrompt).toEqual('undefined');
});
test('Check user input for empty string without flags', async () => {
const cliPrompt = await cli('', []);
expect(cliPrompt).toEqual('You did not enter a question. Please enter one');
});
test('Check user input for empty string with flags', async () => {
const cliPrompt = await cli('', ['--asc', '--votes']);
expect(cliPrompt).toEqual('You did not enter a question. Please enter one');
});
test('Check output of inline/block code', async () => {
const output_result = output(" ``` check ``` `test!` ");
console.log(output_result)
});
test('Check saving function works well', async () => {
const save_result = await save("title","body","answer");
})
test('Check open function works well', async () => {
const open_result = await browser("www.naver.com")
})