All files / src/lib/openapi/mappers feature-strategy.mapper.ts

66.67% Statements 2/3
0% Branches 0/4
50% Functions 1/2
66.67% Lines 2/3

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            59x                                 4x            
import { SchemaMapper } from './mapper';
import { IFeatureStrategy } from '../../types/model';
import { CreateStrategySchema } from '../spec/create-strategy-schema';
import { UpdateStrategySchema } from '../spec/update-strategy-schema';
import { FeatureStrategySchema } from '../spec/feature-strategy-schema';
 
export class FeatureStrategyMapper
    implements
        SchemaMapper<
            FeatureStrategySchema,
            IFeatureStrategy,
            CreateStrategySchema | UpdateStrategySchema
        >
{
    fromPublic(input: FeatureStrategySchema): IFeatureStrategy {
        return {
            ...input,
            id: input.id || '',
            projectId: input.projectId! || '',
        };
    }
 
    toPublic(input: IFeatureStrategy): FeatureStrategySchema {
        return {
            ...input,
            name: input.strategyName,
        };
    }
}