Stryker

metadata.ts - Stryker report

File / Directory
Mutation score
# Killed
# Survived
# Timeout
# No coverage
# Runtime errors
# Transpile errors
Total detected
Total undetected
Total mutants
metadata.ts
0.00 %
0.00 0 1 0 0 16 0 0 1 17
Expand all
'use strict';

import { HttpMethod } from './server-types';

export type PreprocessorFunction = (req: Express.Request) => Express.Request;

export interface SeviceProperty {
    type: ParamType;
    name: string;
    propertyType: any;
}

/**
 * Metadata for REST service classes
 */
export class ServiceClass {

    public targetClass: any;
    public path: string;
    public roles: Array<string>;
    public processors: Array<PreprocessorFunction>;
    public methods: Map<string, ServiceMethod>;
    public languages: Array<string>;
    public accepts: Array<string>;
    public properties: Map<string, SeviceProperty>;
    public isAbstract: boolean = 0false;
    constructor(targetClass: any) 1{
        this.targetClass = targetClass;
        this.methods = new Map<string, ServiceMethod>();
        this.properties = new Map<string, SeviceProperty>();
        this.languages = 2new Array<string>();
        this.accepts = 3new Array<string>();
    }

    public addProperty(key: string, paramType: ParamType, paramName: string, propertyType: any) 4{
        this.properties.set(key, { type: paramType, name: paramName, propertyType: propertyType });
    }

    public hasProperties(): boolean 5{
        return (this.properties 6&& this.properties.size 78> 0);
    }
}

/**
 * Metadata for REST service methods
 */
export class ServiceMethod {
    public name: string;
    public path: string;
    public roles: Array<string>;
    public resolvedPath: string;
    public httpMethod: HttpMethod;
    public parameters: Array<MethodParam> = 9new Array<MethodParam>();
    public mustParseCookies: boolean = 10false;
    public files: Array<FileParam> = 11new Array<FileParam>();
    public mustParseBody: boolean = 12false;
    public bodyParserOptions: any;
    public mustParseForms: boolean = 13false;
    public acceptMultiTypedParam: boolean = 14false;
    public languages: Array<string>;
    public accepts: Array<string>;
    public resolvedLanguages: Array<string>;
    public resolvedAccepts: Array<string>;
    public processors: Array<PreprocessorFunction>;
}

/**
 * Metadata for File parameters on REST methods
 */
export class FileParam {

    public name: string;
    public singleFile: boolean;
    constructor(name: string, singleFile: boolean) 15{
        this.name = name;
        this.singleFile = singleFile;
    }
}

/**
 * Metadata for REST service method parameters
 */
export class MethodParam {

    public name: string;
    public type: Function;
    public paramType: ParamType;
    constructor(name: string, type: Function, paramType: ParamType) 16{
        this.name = name;
        this.type = type;
        this.paramType = paramType;
    }
}

/**
 * Enumeration of accepted parameter types
 */
export enum ParamType {
    path,
    query,
    header,
    cookie,
    form,
    body,
    param,
    file,
    files,
    context,
    context_request,
    context_response,
    context_next,
    context_accept,
    context_accept_language
}
# Mutator State Location Original Replacement
0 BooleanSubstitution RuntimeError 25 : 33
1 Block RuntimeError 26 : 34 { ... } {}
2 ArrayNewExpression RuntimeError 30 : 25 < >() ([])
3 ArrayNewExpression RuntimeError 31 : 23 < >() ([])
4 Block RuntimeError 34 : 96 { ... } {}
5 Block RuntimeError 38 : 36 { ... } {}
6 BinaryExpression RuntimeError 39 : 32 && ||
7 BinaryExpression RuntimeError 39 : 56 > <=
8 BinaryExpression RuntimeError 39 : 56 > >=
9 ArrayNewExpression RuntimeError 52 : 44 < >() ([])
10 BooleanSubstitution Survived 53 : 39
11 ArrayNewExpression RuntimeError 54 : 37 < >() ([])
12 BooleanSubstitution RuntimeError 55 : 36
13 BooleanSubstitution RuntimeError 57 : 37
14 BooleanSubstitution RuntimeError 58 : 44
15 Block RuntimeError 73 : 51 { ... } {}
16 Block RuntimeError 87 : 68 { ... } {}