本文整理匯總了TypeScript中cwlts/models/helpers/JobHelper.JobHelper類的典型用法代碼示例。如果您正苦於以下問題:TypeScript JobHelper類的具體用法?TypeScript JobHelper怎麽用?TypeScript JobHelper使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了JobHelper類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: it
it("should remove entries for non-existing inputs", () => {
const model = makeToolWithInputs([
{id: "string_id", type: "string"}
]);
const mockData = JobHelper.getJobInputs(model);
const adapted = fixJob({foo: "bar"}, model);
expect(adapted).toEqual(objectContaining(mockData));
});
示例2: makeMockValue
function makeMockValue(inputID: string, type: string, arrayItemsType: string, recordFields?: InputParameterModel[], enumSymbols?: string[]) {
return JobHelper.generateMockJobData({
id: inputID,
type: {
type: type,
items: arrayItemsType,
fields: recordFields,
symbols: enumSymbols
}
} as InputParameterModel);
}
示例3: fixJob
export function fixJob(jobValue = {}, model: CommandLineToolModel): { [inputID: string]: any } {
const mockData = JobHelper.getJobInputs(model);
const adapted = {};
Object.keys(mockData).forEach(inputID => {
const input = model.inputs.find(i => i.id === inputID);
if (!jobValue.hasOwnProperty(inputID)) {
adapted[inputID] = mockData[inputID];
return;
}
adapted[inputID] = ensureValueType(
jobValue[inputID],
mockData[inputID],
input.type.type,
input.type.items,
input.type.symbols,
input.type.fields
);
});
return adapted;
}