import {MPosControllerBase} from "../src/MPosControllerBase";
import {POS_InterfaceType} from "../src/dataType/POS_InterfaceType";
import {POS_CommandMode} from "../src/dataType/POS_CommandMode";
import {POS_TransactionMode} from "../src/dataType/POS_TransactionMode";
import {POS_ReadMode} from "../src/dataType/POS_ReadMode";

test('TEST_selectInterface',async()=>{

    const printer = new MPosControllerBase();

    return await printer.selectInterface(
        POS_InterfaceType.Bluetooth, ""
    ).then(APIResponse => {
        expect(APIResponse).toBe(1000);
    });
})

test('TEST_selectCommandMode',async()=>{

    const printer = new MPosControllerBase();

    return await printer.selectCommandMode(
        POS_CommandMode.Mode_Default
    ).then(APIResponse => {
        expect(APIResponse).toBe(1000);
    });
});

test('TEST_openService',async()=>{

    const printer = new MPosControllerBase();

    return await printer.openService(

    ).then(APIResponse => {
        expect(APIResponse).toBe(1000);
    });
});

test('TEST_closeService',async()=>{

    const printer = new MPosControllerBase();

    return await printer.closeService(
1
    ).then(APIResponse => {
        expect(APIResponse).toBe(1000);
    });
});

test('TEST_isOpen',async()=>{

    const printer = new MPosControllerBase();

    return await printer.isOpen(

    ).then(APIResponse => {
        expect(APIResponse).toBe(false);
    });
});

test('TEST_getDeviceId',async()=>{

    const printer = new MPosControllerBase();

    return await printer.getDeviceId(

    ).then(APIResponse => {
        expect(APIResponse).toBe(-1);
    });
});

test('TEST_directIO',async()=>{

    const printer = new MPosControllerBase();

    return await printer.directIO(
""
    ).then(APIResponse => {
        expect(APIResponse).toBe(1000);
    });
});

test('TEST_sendFile',async()=>{

    const printer = new MPosControllerBase();

    return await printer.sendFile(
        ""
    ).then(APIResponse => {
        expect(APIResponse).toBe(1000);
    });
});

test('TEST_setTransaction',async()=>{

    const printer = new MPosControllerBase();

    return await printer.setTransaction(
        POS_TransactionMode.Transaction_On
    ).then(APIResponse => {
        expect(APIResponse).toBe(1000);
    });
});

test('TEST_setReadMode',async()=>{

    const printer = new MPosControllerBase();

    return await printer.setReadMode(
        POS_ReadMode.ReadMode_None
    ).then(APIResponse => {
        expect(APIResponse).toBe(1000);
    });
});

test('TEST_setKeepNetworkConnection',async()=>{

    const printer = new MPosControllerBase();

    return await printer.setKeepNetworkConnection(
        1
    ).then(null);
});

test('TEST_getSDKVersion',async()=>{

    const printer = new MPosControllerBase();

    return await printer.getSDKVersion(

    ).then(APIResponse => {
        expect(APIResponse).toBe("version");
    });
});
