<!DOCTYPE html>
<html>
<head>
<script src="../../http/tests/inspector/resources/inspector-test.js"></script>
<script>
function test()
{
    let suite = InspectorTest.createAsyncSuite("AuditTestCase");

    function addPayloadTest({name, payload}) {
        suite.addTestCase({
            name,
            async test() {
                let object = await WI.AuditTestCase.fromPayload(payload);

                function replacer(key, value) {
                    if (key === "supports")
                        return `<version + ${value - WI.AuditTestBase.Version}>`;

                    return value;
                }
                InspectorTest.log(object ? JSON.stringify(object, replacer, 2) : object);
            },
        });
    }

    let payloadTests = [
        {
            name: "AuditTestCase.fromPayload.nullObject",
            payload: null,
        },
        {
            name: "AuditTestCase.fromPayload.nonObject",
            payload: "INVALID",
        },
        {
            name: "AuditTestCase.fromPayload.emptyObject",
            payload: {},
        },
        {
            name: "AuditTestCase.fromPayload.invalidTopLevelMembers",
            payload: {
                type: null,
                name: null,
                test: null,
            },
        },
        {
            name: "AuditTestCase.fromPayload.valid",
            payload: {
                type: WI.AuditTestCase.TypeIdentifier,
                name: "valid test name",
                test: "function() { }",
            },
        },
        {
            name: "AuditTestCase.fromPayload.validWithInvalidOptionals",
            payload: {
                type: WI.AuditTestCase.TypeIdentifier,
                name: "validWithInvalidOptionals test name",
                description: null,
                supports: WI.AuditTestBase.Version + 1,
                setup: null,
                test: "validWithInvalidOptionals test function",
            },
        },
        {
            name: "AuditTestCase.fromPayload.validWithValidOptionals",
            payload: {
                type: WI.AuditTestCase.TypeIdentifier,
                name: "validWithValidOptionals test name",
                description: "validWithValidOptionals test description",
                supports: WI.AuditTestBase.Version - 1,
                setup: "validWithValidOptionals test setup",
                test: "validWithValidOptionals test function",
            },
        },
    ];
    payloadTests.forEach(addPayloadTest);

    suite.runTestCasesAndFinish();
}
</script>
</head>
<body onload="runTest()">
    <p>Testing the functions of WI.AuditTestCase.</p>
</body>
</html>
