A test case in js always returns undefined when calling the main function

< H2 > Test function < / H2 >
let sinon = require("sinon");
let main = require("../lib/main");

describe("main()", () => {

    it("should display main menu once started", () => {
        sinon.spy(console, "log");
        main();
        expect(console.log.args.join()).toBe(`1. 
2. 
3. 
13:`);
    });

    it("should display :, , , , : , ...", () => {
        // sinon.spy(console, "log");
        const display = main();
        // console.log(display)
        expect(display).toBe(":, , , , : , ...:")
    }) 

});
< H2 > function under test < / H2 >
module.exports = () => {
    function choice1(){
        let display = ":, , , , : , ...:"
        return display;
    }
    function choice2(){
    
    }
    function choice3(){
    
    }
    function invalidInput1(){
    
    }
    function defaultPage(){
        console.log( `1. 
2. 
3. 
13:`)
    }

    defaultPage();
    var readlineSync = require("readline-sync");
    var answer = readlineSync.question();
    if(answer == 1){
        choice1();
    }else if(answer == 2){
        choice2();
    }else if(answer == 3){
        choice3();
    }else{
        return "Bad choice, please choose again!"
    }
}
< H2 > run results < / H2 >

clipboard.png

Mar.21,2021

if(answer == 1){ return choice1(); }
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b307ee-2bd48.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b307ee-2bd48.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?