@finos/legend-application-pure-ide
Version:
Legend Pure IDE application core
100 lines • 2.8 kB
JavaScript
/**
* Copyright (c) 2020-present, Goldman Sachs
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { createModelSchema, custom, deserialize, list, object, primitive, SKIP, } from 'serializr';
export class PCTAdapter {
name;
func;
constructor(name, func) {
this.name = name;
this.func = func;
}
}
export var TestResultStatus;
(function (TestResultStatus) {
// PASSED = 'passed',
TestResultStatus["PASSED"] = "Success";
TestResultStatus["FAILED"] = "AssertFail";
TestResultStatus["ERROR"] = "Error";
TestResultStatus["NOT_RUN"] = "notRan";
})(TestResultStatus || (TestResultStatus = {}));
export class TestResult {
// console!: string;
// compiler!: string;
status;
test;
}
export class TestSuccessResult extends TestResult {
test = [];
}
createModelSchema(TestSuccessResult, {
status: primitive(),
test: list(primitive()),
});
export class TestFailureResultError {
text;
RO;
line;
column;
source;
error;
}
createModelSchema(TestFailureResultError, {
text: primitive(),
RO: primitive(),
line: primitive(),
column: primitive(),
source: primitive(),
error: primitive(),
});
export class TestFailureResult extends TestResult {
test = [];
error;
}
createModelSchema(TestFailureResult, {
status: primitive(),
test: list(primitive()),
error: object(TestFailureResultError),
});
export class AbstractTestRunnerCheckResult {
}
export class TestRunnerCheckResult extends AbstractTestRunnerCheckResult {
finished;
tests = [];
}
createModelSchema(TestRunnerCheckResult, {
finished: primitive(),
tests: list(custom(() => SKIP, (value) => {
if (value.error) {
return deserialize(TestFailureResult, value);
}
return deserialize(TestSuccessResult, value);
})),
});
export class TestRunnerCheckError extends AbstractTestRunnerCheckResult {
error;
text;
}
createModelSchema(TestRunnerCheckError, {
error: primitive(),
text: primitive(),
});
export const deserializeTestRunnerCheckResult = (value) => {
if (value.error) {
return deserialize(TestRunnerCheckError, value);
}
return deserialize(TestRunnerCheckResult, value);
};
//# sourceMappingURL=Test.js.map