@angular-package/testing
Version:
Jasmine unit testing wrapper with additional custom testing features.
1 lines • 2.12 kB
JavaScript
import{mixin}from"./function";import{TestingToBeArrayOf,TestingToBeBoolean,TestingToBeGreaterThan,TestingToBeInstanceOf,TestingToBeLessThan,TestingToBeNumber,TestingToBeObject,TestingToBeString,TestingToBe,TestingToHave,TestingToThrow,TestingTo}from"./testing";import{TestingActual}from"./testing-actual.class";import{TestingCore}from"./testing-core.abstract";import{TestingDescribe}from"./testing-describe.class";import{TestingExpectation}from"./testing-expectation.class";import{TestingIt}from"./testing-it.class";export class Testing extends(mixin(TestingToBeArrayOf,TestingToBeBoolean,TestingToBeGreaterThan,TestingToBeInstanceOf,TestingToBeLessThan,TestingToBeNumber,TestingToBeObject,TestingToBeString,TestingToBe,TestingToHave,TestingToThrow,TestingTo)){static defineDescribe(e,t){return TestingDescribe.define(e,t)}static defineIt(e,t,s){return TestingIt.define(e,t,s)}get expect(){return this.testingCore.expect}allowDescribe;allowIt;executable;testingCore;constructor(e=!0,t=!0,s,i=[!0,!1],r=new TestingDescribe(e,s?.describe,i),n=new TestingIt(t,s?.it,i),o=new TestingExpectation){super(e,t,s,i,r,n,o),this.allowDescribe=e,this.allowIt=t,this.executable=s,this.testingCore=new class extends TestingCore{}(this.allowDescribe,this.allowIt,this.executable,i,r,n,o)}actual(e,t){return t(new TestingActual(this.allowDescribe,this.allowIt).actual(e)),this}afterAll(e,t,s=!0){return(s=>{s&&afterAll(e,t)})(s),this}afterEach(e,t,s=!0){return(s=>{s&&afterEach(e,t)})(s),this}beforeAll(e,t,s=!0){return(s=>{s&&beforeAll(e,t)})(s),this}beforeEach(e,t,s=!0){return(s=>{s&&beforeEach(e,t)})(s),this}describe(e,t,s){return this.testingCore.describe(e,t,s),this}fdescribe(e,t){return this.testingCore.fdescribe(e,t),this}it(e,t,s){return this.testingCore.it(e,t,s),this}setSpecProperty(e,t){return this.testingCore.setSpecProperty(e,t),this}setSuiteProperty(e,t){return this.testingCore.setSuiteProperty(e,t),this}spec(e,t="",s){return this.testingCore.spec(e,t,s),this}spy(e,t){return t(new TestingActual(this.allowDescribe,this.allowIt,this.executable).spy(e)),this}xdescribe(e,t){return this.testingCore.xdescribe(e,t),this}}