import React , { useContext } from "react" ; const request = require ( "supertest" ) ; const fs = require ( "fs" ) ; const path = require ( "path" ) ; import { TestContext } from "../../provider/TestProvider" ; import { StateContext } from "../../provider/StateProvider" ; const { test , monacoPoster } = useContext ( TestContext ) ; const { activePort } = useContext ( StateContext ) ; const db = "./db/markets.js" ; if ( test . methodSelect === "POST" ) { describe ( `${ db }` , ( ) => { it ( `${ test . expectedRes }` , ( done ) => { request ( activePort ) . post ( test . serverApp ) . send ( `value is equivalent to ${ outputDropdown . selectedIndex . text }` ) . expect ( res . status ) . to . be . equal ( 200 ) . done ( ) ; } ) ; } ) ; } const str = `${ test . expectedRes } ` ; monacoPoster ( str ) ; if ( document . getElementById ( "methodSelect" ) === "GET" ) { describe ( `${ db }` , ( ) => { it ( `${ test . expectedRes }` , ( done ) => { request ( activePort ) . get ( test . serverApp ) . set ( { Accept : "application/json" , } ) . expect ( { "Content-Type" : "json" , } ) . done ( ) ; } ) ; } ) ; } if ( document . getElementById ( "methodSelect" ) === "PUT" ) { describe ( `${ db }` , ( ) => { it ( `${ test . expectedRes }` , ( done ) => { request ( activePort ) . put ( test . serverApp ) . set ( { Accept : "application/json" , } ) . expect ( { "Content-Type" : "json" , } ) . done ( ) ; } ) ; } ) ; } if ( document . getElementById ( "methodSelect" ) === "DELETE" ) { describe ( `${ db }` , ( ) => { it ( `${ test . expectedRes }` , ( done ) => { request ( activePort ) . delete ( test . serverApp ) . set ( { Accept : "application/json" , } ) . expect ( { "Content-Type" : "json" , } ) . done ( ) ; } ) ; } ) ; } export default TestSuite ;