All files / src/dev TestContext.ts

87.5% Statements 7/8
62.5% Branches 5/8
100% Functions 1/1
87.5% Lines 7/8

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 31 32 33                                    8x 7x   1x 1x 1x 1x         1x      
import CoreKernel from '../CoreKernel';
 
export default class TestContext {
  static entity: CoreKernel<any> | null;
 
  static cleanUp: boolean;
 
  static modLength: number | null;
 
  /**
   *
   * @param ent testPath
   */
  static getEntity(ent?: {
    kernel: CoreKernel<any>;
    cleanUp?: boolean;
    modLength?: number;
  }): [CoreKernel<any>, boolean, number | null] {
    if (this.entity) {
      return [this.entity, this.cleanUp, this.modLength];
    }
    if (ent) {
      this.entity = ent.kernel;
      this.cleanUp = ent.cleanUp ?? false;
      this.modLength = ent.modLength ?? null;
    } else E{
      throw new Error('NoKernelDefined');
    }
 
    return [this.entity, this.cleanUp, this.modLength];
  }
}