@angular-package/testing
Version:
Jasmine unit testing wrapper with additional custom testing features.
1 lines • 7.74 kB
JavaScript
import{TestingCore}from"./testing-core.abstract";import{TestingDescribe}from"./testing-describe.class";import{TestingExpectation}from"./testing-expectation.class";import{TestingIt}from"./testing-it.class";import{TestingItTo}from"./it/testing-it-to.class";import{TextualExpectation}from"./textual-expectation.abstract";export class TestingActual extends TestingCore{#t;#e;#s;constructor(t=!0,e=!0,s,i=[!0,!1],a=new TestingDescribe(t,s?.describe,i),r=new TestingIt(e,s?.it,i),n=new TestingExpectation){super(t,e,s,i,a,r,n),this.#s=new TestingItTo(t,e,s,i,a,r,n)}actual(t){return this.#t=t,this}spy(t){return this.#e=t,this}toBe(t,e,s,i,a=this.#t){return this.#s.be.be(a,t,e,s,i),this}toBeArray(t=!0,e,s,i,a=this.#t){return this.#s.be.array(a,t,e,s,i),this}toBeBigInt(t=!0,e,s,i,a=this.#t){return this.#s.be.bigInt(a,t,e,s,i),this}toBeBoolean(t,e=!0,s,i,a){return this.#s.be.boolean.boolean(t,e,s,i,a),this}toBeBooleanType(t=!0,e,s,i,a=this.#t){return this.#s.be.boolean.type(a,t,e,s,i),this}toBeClass(t=!0,e,s,i,a=this.#t){return this.#s.be.class(a,t,e,s,i),this}toBeCloseTo(t,e,s,i,a,r=this.#t){return this.#s.be.closeTo(r,t,e,s,i,a),this}toBeDate(t=!0,e,s,i,a=this.#t){return this.#s.be.date(a,t,e,s,i),this}toBeDefined(t=!0,e,s,i,a=this.#t){return this.#s.be.defined(a,t,e,s,i),this}toBeFalse(t=!0,e,s,i,a=this.#t){return this.#s.be.false(a,t,e,s,i),this}toBeFalsy(t=!0,e,s,i,a=this.#t){return this.#s.be.falsy(a,t,e,s,i),this}toBeFunction(t=!0,e,s,i,a=this.#t){return this.#s.be.function(a,t,e,s,i),this}toBeGreaterThan(t,e,s,i,a=this.#t){return this.#s.be.greaterThan(a,t,e,s,i),this}toBeGreaterThanOrEqual(t,e,s,i,a=this.#t){return this.#s.be.greaterThanOrEqual(a,t,e,s,i),this}toBeInstance(t,e=!0,s,i,a,r=this.#t){return this.#s.be.instance(r,t,e,s,i,a),this}toBeInstanceOf(t,e,s,i,a=this.#t){return this.#s.be.instanceOf(a,t,e,s,i),this}toBeInstanceOfArray(t=!0,e,s,i,a=this.#t){return this.#s.be.instanceof.array(a,t,e,s,i),this}toBeInstanceOfBoolean(t=!0,e,s,i,a=this.#t){return this.#s.be.instanceof.boolean(a,t,e,s,i),this}toBeInstanceOfDate(t=!0,e,s,i,a=this.#t){return this.#s.be.instanceof.date(a,t,e,s,i),this}toBeInstanceOfError(t=!0,e,s,i,a=this.#t){return this.#s.be.instanceof.error(a,t,e,s,i),this}toBeInstanceOfFunction(t=!0,e,s,i,a=this.#t){return this.#s.be.instanceof.function(a,t,e,s,i),this}toBeInstanceOfMap(t=!0,e,s,i,a=this.#t){return this.#s.be.instanceof.map(a,t,e,s,i),this}toBeInstanceOfNumber(t=!0,e,s,i,a=this.#t){return this.#s.be.instanceof.number(a,t,e,s,i),this}toBeInstanceOfObject(t=!0,e,s,i,a=this.#t){return this.#s.be.instanceof.object(a,t,e,s,i),this}toBeInstanceOfPromise(t=!0,e,s,i,a=this.#t){return this.#s.be.instanceof.promise(a,t,e,s,i),this}toBeInstanceOfRangeError(t=!0,e,s,i,a=this.#t){return this.#s.be.instanceof.rangeError(a,t,e,s,i),this}toBeInstanceOfReferenceError(t=!0,e,s,i,a=this.#t){return this.#s.be.instanceof.referenceError(a,t,e,s,i),this}toBeInstanceOfRegExp(t=!0,e,s,i,a=this.#t){return this.#s.be.instanceof.regExp(a,t,e,s,i),this}toBeInstanceOfSet(t=!0,e,s,i,a=this.#t){return this.#s.be.instanceof.set(a,t,e,s,i),this}toBeInstanceOfStorage(t=!0,e,s,i,a=this.#t){return this.#s.be.instanceof.storage(a,t,e,s,i),this}toBeInstanceOfString(t=!0,e,s,i,a=this.#t){return this.#s.be.instanceof.string(a,t,e,s,i),this}toBeInstanceOfSyntaxError(t=!0,e,s,i,a=this.#t){return this.#s.be.instanceof.syntaxError(a,t,e,s,i),this}toBeInstanceOfTypeError(t=!0,e,s,i,a=this.#t){return this.#s.be.instanceof.typeError(a,t,e,s,i),this}toBeInstanceOfURIError(t=!0,e,s,i,a=this.#t){return this.#s.be.instanceof.URIError(a,t,e,s,i),this}toBeInstanceOfWeakSet(t=!0,e,s,i,a=this.#t){return this.#s.be.instanceof.weakSet(a,t,e,s,i),this}toBeKey(t=!0,e,s,i,a=this.#t){return this.#s.be.key(a,t,e,s,i),this}toBeLessThan(t,e,s,i,a=this.#t){return this.#s.be.lessThan(a,t,e,s,i),this}toBeLessThanOrEqual(t,e,s,i,a=this.#t){return this.#s.be.lessThanOrEqual(a,t,e,s,i),this}toBeNaN(t=!0,e,s,i,a=this.#t){return this.#s.be.naN(a,t,e,s,i),this}toBeNegativeInfinity(t=!0,e,s,i,a=this.#t){return this.#s.be.negativeInfinity(a,t,e,s,i),this}toBeNull(t=!0,e,s,i,a=this.#t){return this.#s.be.null(a,t,e,s,i),this}toBeNumber(t=!0,e,s,i,a=this.#t){return this.#s.be.number(a,t,e,s,i),this}toBeNumberBetween(t,e,s=!0,i,a,r,n=this.#t){return this.#s.be.numberBetween(n,t,e,s,i,a,r),this}toBeNumberType(t=!0,e,s,i,a=this.#t){return this.#s.be.numberType(a,t,e,s,i),this}toBeObject(t=!0,e,s,i,a=this.#t){return this.#s.be.object(a,t,e,s,i),this}toBeObjectKey(t,e=!0,s,i,a,r=this.#t){return this.#s.be.objectKey(r,t,e,s,i,a),this}toBeObjectKeyIn(t,e=!0,s,i,a,r=this.#t){return this.#s.be.objectKeyIn(r,t,e,s,i,a),this}toBeObjectKeys(t,e,s=!0,i,a,r){return this.#s.be.objectKeys(t,e,s,i,a,r),this}objectKeysIn(t,e=!0,s,i,a,r=this.#t){return this.#s.be.objectKeysIn(r,t,e,s,i,a),this}objectSomeKeys(t,e=!0,s,i,a,r=this.#t){return this.#s.be.objectSomeKeys(r,t,e,s,i,a),this}toBePositiveInfinity(t=!0,e,s,i,a=this.#t){return this.#s.be.positiveInfinity(a,t,e,s,i),this}toBeRegExp(t=!0,e,s,i,a=this.#t){return this.#s.be.regExp(a,t,e,s,i),this}toBeRejected(t,e,s,i=this.#t){return this.#s.be.rejected(i,t,e,s),this}toBeRejectedWith(t,e,s,i=this.#t){return this.#s.be.rejectedWith(i,t,e,s),this}toBeRejectedWithError(t,e,s,i,a,r=this.#t){return this.#s.be.rejectedWithError(r,t,e,s,i,a),this}toBeResolved(t,e,s,i=this.#t){return this.#s.be.resolved(i,t,e,s),this}toBeResolvedTo(t,e,s,i,a=this.#t){return this.#s.be.resolvedTo(a,t,e,s,i),this}toBeString(t=!0,e,s,i,a=this.#t){return this.#s.be.string(a,t,e,s,i),this}stringIncludes(t,e,s,i,a,r=this.#t){return this.#s.be.stringIncludes(r,t,e,s,i,a),this}stringIncludesSome(t,e,s,i,a,r=this.#t){return this.#s.be.stringIncludesSome(r,t,e,s,i,a),this}stringOfLength(t,e,s,i,a,r=this.#t){return this.#s.be.stringOfLength(r,t,e,s,i,a),this}stringOfLengthBetween(t,e,s,i,a,r,n=this.#t){return this.#s.be.stringOfLengthBetween(n,t,e,s,i,a,r),this}toBeStringType(t=!0,e,s,i,a=this.#t){return this.#s.be.stringType(a,t,e,s,i),this}toBeSymbol(t=!0,e,s,i,a=this.#t){return this.#s.be.symbol(a,t,e,s,i),this}toBeTrue(t=!0,e,s,i,a=this.#t){return this.#s.be.true(a,t,e,s,i),this}toBeTruthy(t=!0,e,s,i,a=this.#t){return this.#s.be.truthy(a,t,e,s,i),this}toBeUndefined(t=!0,e,s,i,a=this.#t){return this.#s.be.undefined(a,t,e,s,i),this}toContain(t,e,s,i,a=this.#t){return this.#s.contain(a,t,e,s,i),this}toEqual(t,e,s,i,a=this.#t){return this.#s.equal(a,t,e,s,i),this}toHaveBeenCalled(t=TextualExpectation.toHaveBeenCalled,e,s,i=this.#e){return this.it(t,(()=>super.expect.to.have.been.called.called(i(),e)),s),this}toHaveBeenCalledBefore(t,e=TextualExpectation.toHaveBeenCalledBefore,s,i,a=this.#e){return this.it(e,(()=>super.expect.to.have.been.called.before(a(),t,s)),i),this}toHaveBeenCalledOnceWith(...t){return this.it(TextualExpectation.toHaveBeenCalledOnceWith,(()=>super.expect.to.have.been.called.onceWith(this.#e(),...t)),!0),this}toHaveBeenCalledTimes(t,e=TextualExpectation.toHaveBeenCalledTimes,s,i,a=this.#e){return this.it(e,(()=>super.expect.to.have.been.called.times(a(),t,s)),i),this}toHaveBeenCalledWith(...t){return this.it(TextualExpectation.toHaveBeenCalledWith,(()=>super.expect.to.have.been.called.with(this.#e(),...t)),!0),this}toHaveClass(t,e,s,i,a=this.#t){return this.#s.have.class(a,t,e,s,i),this}toHaveSize(t,e,s,i,a=this.#t){return this.#s.have.size(a,t,e,s,i),this}toHaveSpyInteractions(t,e,s,i=this.#t){return this.#s.have.spyInteractions(i,t,e,s),this}toMatch(t,e,s,i,a=this.#t){return this.#s.match(a,t,e,s,i),this}toThrow(t,e,s,i,a=this.#t){return this.#s.throw.throw(a,t,e,s,i),this}toThrowError(t,e,s,i,a=this.#t){return this.#s.throw.error(a,t,e,s,i),this}toThrowMatching(t,e,s,i,a=this.#t){return this.#s.throw.matching(a,t,e,s,i),this}}