All files / blueprint from.ts

100% Statements 7/7
100% Branches 2/2
100% Functions 1/1
100% Lines 7/7

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 173x 3x             3x 23x 23x 1x     22x    
import { retrieve } from './registry';
import { generate } from '../generate';
import { BlueprintConstantProperties } from './blueprint';
 
 
/**
 * Returns a mock from a previously registered `Blueprint`
 */
export function from<T>(name: string, withDefaults?: BlueprintConstantProperties<T>): T {
  const blueprint = retrieve(name);
  if (!blueprint) {
    throw new Error(`Cannot find blueprint for name ${name}`);
  }
 
  return generate<T>(blueprint, withDefaults);
}