All files / test/Ice/operations Oneways.js

80.76% Statements 42/52
28.57% Branches 2/7
100% Functions 1/1
80.76% Lines 42/52

Press n or j to go to the next uncovered block, b, p or k for the previous block.

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 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 531x 1x 1x 1x 1x 1x 1x 1x 1x     1x 1x 1x 1x 1x 1x     1x 1x 1x 1x 1x 1x     1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x     1x 1x 1x 1x 1x     1x 1x 1x 1x 1x  
// Copyright (c) ZeroC, Inc.
import { Ice } from "@zeroc/ice";
import { Test } from "./Test.js";
import { test } from "../../Common/TestHelper.js";
export async function oneways(prx) {
    prx = prx.ice_oneway();
    await prx.ice_ping();
    try {
        await prx.ice_isA(Test.MyClass.ice_staticId());
        test(false);
    }
    catch (ex) {
        // Expected: twoway proxy required
        test(ex instanceof Ice.TwowayOnlyException, ex);
    }
    try {
        await prx.ice_id();
        test(false);
    }
    catch (ex) {
        // Expected: twoway proxy required
        test(ex instanceof Ice.TwowayOnlyException, ex);
    }
    try {
        await prx.ice_ids();
        test(false);
    }
    catch (ex) {
        // Expected: twoway proxy required
        test(ex instanceof Ice.TwowayOnlyException, ex);
    }
    await prx.opVoid();
    await prx.opIdempotent();
    // Calling a ["oneway"] operation on a oneway proxy succeeds.
    await prx.opOneway();
    // Calling a ["oneway"] operation on a twoway proxy throws OnewayOnlyException.
    try {
        await prx.ice_twoway().opOneway();
        test(false);
    }
    catch (ex) {
        test(ex instanceof Ice.OnewayOnlyException, ex);
    }
    try {
        await prx.opByte(0xff, 0x0f);
        test(false);
    }
    catch (ex) {
        // Expected: twoway proxy required
        test(ex instanceof Ice.TwowayOnlyException, ex);
    }
}