npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@angular-package/testing

v3.0.0-alpha.3

Published

Jasmine unit testing wrapper with additional custom testing features.

Downloads

359

Readme

angular-package

The angular-package supports the development process of angular-based applications in varied ways through the thoughtful, reusable, easy-to-use small pieces of code called packages.

Testing

@angular-package/testing

Jasmine unit testing wrapper with additional custom testing features.

Gitter Discord Twitter

npm version

GitHub issues GitHub forks GitHub stars GitHub license

GitHub sponsors Support me on Patreon

Table of contents

Basic concepts

Checks

It's to check the provided value to be the same as expected.

Type guard (constrain)

Constrains the parameter type to not let input unexpected value in the code editor.

Guards

It's a combination of both above, constrains the type of the parameter in the code editor, and checks its provided argument.

Defines

Returns defined value from a method of an object.
Defines new value in an object and returns a defined value.

Gets

Returns a value from an object.

Sets

Adds or updates an element with a specified key and a value to an object and returns an object.

Skeleton

This package was built by the library skeleton which was generated with Angular CLI version 12.2.5.

Copy this package to the packages/testing folder of the library skeleton then run the commands below.

Build

Run ng build testing to build the package. The build artifacts will be stored in the dist/ directory.

Running unit tests

Run ng test testing to execute the unit tests via Karma.

Installation

Install @angular-package/testing package with command:

npm i --save @angular-package/testing

Dependencies

npm i tslib
npm i jasmine

Api

/**
 * Main.
 */
export {
  Random,

  Testing, // Main class with all testings.
  TestingActual, // Initialize testing for `actual`.
  TestingCustom, // Class to pass custom testings.

  // Full named expectations. Methods with `expect()` + jasmine matchers.
  TestingExpectation,

  // Class to handle `describe()` function of jasmine.
  TestingDescribe,

  // Class to handle `it()` function of jasmine.
  TestingIt,

  // Class to handle `expect()` function of jasmine.
  TestingExpect,

  // Class to handle `describe`, `it`, `expect` of jasmine.
  TestingCore,

  // Abstract class to handle executable tests.
  TestingExecutable,
} from './lib';

// Specific expectations.
export {
  TestingExpectTo,
  TestingExpectToBe,
  TestingExpectToBeArrayOf,
  TestingExpectToBeInstanceOf,
  TestingExpectToHave,
  TestingExpectToHaveBeen,
  TestingExpectToHaveBeenCalled,
  TestingExpectToThrow,
} from './lib/expectation';

// Methods with `it()` function of jasmine.
export {
  TestingItTo,
  TestingItToBe,
  TestingItToBeArrayOf,
  TestingItToBeBoolean,
  TestingItToBeInstanceOf,
  TestingItToHave,
  TestingItToHaveBeen,
  TestingItToHaveBeenCalled,
  TestingItToThrow,
} from './lib/it';

// Testing classes for use with `TestingCustom`.
export {
  TestingTo,
  TestingToBe,
  TestingToBeArrayOf,
  TestingToBeBoolean,
  TestingToBeGreaterThan,
  TestingToBeInstanceOf,
  TestingToBeLessThan,
  TestingToBeNumber,
  TestingToBeObject,
  TestingToBeString,
  TestingToHave,
  TestingToThrow,
} from './lib/testing';
// Helper constants.
import {
  // Example class for testing.
  TestingClass,
  TestingPerson,

  // Array.
  TESTING_ARRAY_BIGINT,
  TESTING_ARRAY_BOOLEAN,
  TESTING_ARRAY_CLASS,
  TESTING_ARRAY_FUNCTION,
  TESTING_ARRAY_NULL,
  TESTING_ARRAY_NUMBER,
  TESTING_ARRAY_OBJECT_ONE,
  TESTING_ARRAY_STRING,
  TESTING_ARRAY_SYMBOL_NUMBER,
  TESTING_ARRAY_SYMBOL_STRING,
  TESTING_ARRAY_UNDEFINED,
  // BigInt
  TESTING_BIGINT,
  // Class.
  TESTING_CLASS,
  TESTING_PERSON,
  // Date.
  TESTING_DATE,
  // Boolean.
  TESTING_FALSE,
  TESTING_FALSE_INSTANCE,
  TESTING_TRUE,
  TESTING_TRUE_INSTANCE,
  // Function.
  TESTING_FUNCTION,
  TESTING_FUNCTION_CONSTRUCTOR,
  TESTING_FUNCTION_CONSTRUCTOR_PERSON,
  // null.
  TESTING_NULL,
  // Number.
  TESTING_NUMBER,
  TESTING_NUMBER_CONSTRUCTOR,
  TESTING_NUMBER_INSTANCE,
  // Object.
  TESTING_OBJECT,
  // RegExp.
  TESTING_REGEXP,
  // String.
  TESTING_STRING,
  TESTING_STRING_CONSTRUCTOR,
  TESTING_STRING_INSTANCE,
  // Symbol.
  TESTING_SYMBOL_NUMBER,
  TESTING_SYMBOL_STRING,
  // Undefined.
  TESTING_UNDEFINED,
} from '@angular-package/testing';
import {
  // Interface. 
  TestingObject,
  TestingPersonShape
} from '@angular-package/testing';

Usage

Testing class

Main class for testing.

import { Testing } from "@angular-package/testing";

const t = new Testing();

// Describe.
t.describe(`Describe`, () => {
  // Prepared `it` spec.
  t.toBeBigInt(BigInt(37));
  // Prepared expectation.
  t.it(`It`, () => t.expect.toBeBigInt(BigInt(27)));
});

TestingActual

Class to set actual value and use multiple testing it methods. It can be used through the actual() or spy() methods of Testing.

Example

import { TestingActual } from "@angular-package/testing";

const t = new TestingActual();

class ClassA {
  public methodA(value?: any) {
    return "methodA";
  }

  public methodB(value?: any) {
    return "methodB";
  }
}

const classA = new ClassA();

t.describe('TestingActual', () => {

  // 
  t
    .actual('a b c d e f g h i j k l m n o p r s')
    .toBeString()
    .stringIncludes(['f'])
    .stringIncludesSome(['f', 'z'])
    .stringOfLengthBetween(27, 47)
    .toBeStringType()
  
  t
    .beforeEach(() => {
      spyOn(classA, "methodA");
      classA.methodA({test: 27});
    })
    .spy(() => classA.methodA)
    .toHaveBeenCalled()
    .toHaveBeenCalledWith({test: 27})
    .toHaveBeenCalledTimes(1)
    .toHaveBeenCalledOnceWith({test: 27})
});

TestingCustom

Use TestingCustom class for custom testing. Access to the included tests is through the testing getter.

import {
  TestingCustom,
  TestingDescribe,
  TestingExpectation,
  TestingIt,
  TestingToBe,
} from "@angular-package/testing";

const t = new TestingCustom(
  // List of test to use.
  [
    TestingToBe
  ],
  true, // Describe executable.
  true, // It executable.
  { describe: [], it: [] }, // Executable numbers of `describe` and `it`.
  ['DescribeA'], // Descriptions for `describe`.
  ['ItA'], // Expectations for `it`.
  [false, false], // `boolean` or list of [`boolean`, `boolean`]
  new TestingDescribe(), // Common instance for `TestingDescribe` for `counter` purposes
  new TestingIt(),  // Common instance for `TestingIt` for `counter` purposes
  new TestingExpectation() // Common instance for `TestingExpectation`
);

t.describe(
  `DescribeA`,
  () => t.testing // testing getter
    .beforeEach(() => {})
    .toBeDate(new Date())
    .toBeUndefined(undefined)
);

Features

Expectations

Expectation is a method built from expect() and jasmine matcher.

public expectation(actual, expected) {
  expect(actual).matcher(expected);
  return this;
}

Nested expectations

Expectation methods are accessed in TestingExpectTo by using nested object structure and method names.

Example

import { Testing, TestingExpectTo } from "@angular-package/testing";

const t = new Testing();
const to = new TestingExpectTo();

t.describe(`TestingExpectTo`, () => t
  .it(`it`, () => to
    .contain(['a', 'b', 'c'], 'c')
    .contain('string number', 'ber')
    .equal({a: 2}, {a: 2})
    .match("my string", /string$/)
    .match('number', 'ber')

    .not.contain(['a', 'b', 'c'], 'h')
    .contain(['a', 'b', 'c'], 'a')

    .be.not.bigint('a')
  )
);

Standalone expectations

Expectation methods are directly accessed in TestingExpectation by using method names instead of nested structure, but using it through the TestingExpectTo.

Example expectation method with actual param.

public toBeTypeOf<T>(
  actual: ExpectType<T>,
  expected: jasmine.Expected<string>,
  expectationFailOutput?: any
): this {
  this.#testingTo.be.typeOf(actual, expected, expectationFailOutput);
  return this;
}

Example expectation method with spy param.

public toHaveBeenCalled<T extends jasmine.Func>(
  spy: ExpectType<T>,
  expectationFailOutput?: any
): this {
  this.#testingTo.have.been.called.called(spy, expectationFailOutput);
  return this;
}

Jasmine matchers in use.

  • [x] toBe()
  • [x] toBeCloseTo()
  • [x] toBeDefined()
  • [x] toBeFalse()
  • [x] toBeFalsy()
  • [x] toBeGreaterThan()
  • [x] toBeGreaterThanOrEqual()
  • [x] toBeInstanceOf()
  • [x] toBeLessThan()
  • [x] toBeLessThanOrEqual()
  • [x] toBeNaN()
  • [x] toBeNegativeInfinity()
  • [x] toBeNull()
  • [x] toBePositiveInfinity()
  • [x] toBeTrue()
  • [x] toBeTruthy()
  • [x] toBeUndefined()
  • [x] toContain()
  • [x] toEqual()
  • [x] toHaveBeenCalled()
  • [x] toHaveBeenCalledBefore()
  • [x] toHaveBeenCalledOnceWith()
  • [x] toHaveBeenCalledTimes()
  • [x] toHaveBeenCalledWith()
  • [x] toHaveClass()
  • [x] toHaveSize()
  • [x] toHaveSpyInteractions()
  • [x] toMatch()
  • [x] toThrow()
  • [x] toThrowError()
  • [x] toThrowMatching()

Expectations based on the instanceOf matcher of jasmine.

  • [x] toBeInstanceOfArray()
  • [x] toBeInstanceOfBoolean()
  • [x] toBeInstanceOfDate()
  • [x] toBeInstanceOfError()
  • [x] toBeInstanceOfFunction()
  • [x] toBeInstanceOfMap()
  • [x] toBeInstanceOfNumber()
  • [x] toBeInstanceOfObject()
  • [x] toBeInstanceOfPromise()
  • [x] toBeInstanceOfRangeError()
  • [x] toBeInstanceOfReferenceError()
  • [x] toBeInstanceOfRegExp()
  • [x] toBeInstanceOfSet()
  • [ ] toBeInstanceOfStorage()
  • [x] toBeInstanceOfString()
  • [x] toBeInstanceOfSyntaxError()
  • [x] toBeInstanceOfTypeError()
  • [x] toBeInstanceOfURIError()
  • [x] toBeInstanceOfWeakSet()

Expectations based on the is of @angular-package/type and toBe() matcher of jasmine.

  • [x] toBeArray()
  • [x] toBeBigInt()
  • [x] toBeBoolean()
  • [x] toBeBooleanType()
  • [x] toBeClass()
  • [x] toBeDate()
  • [x] toBeFunction()
  • [x] toBeInstance()
  • [x] toBeKey()

Number

  • [x] toBeNumber()
  • [x] toBeNumberBetween()
  • [x] toBeNumberType()

Object

  • [x] toBeObject()
  • [x] toBeObjectKey()
  • [x] toBeObjectKeyIn()
  • [x] toBeObjectKeys()
  • [x] toBeObjectKeysIn()
  • [x] toBeObjectSomeKeys()

String

  • [x] toBeString()
  • [x] toBeStringIncludes()
  • [x] toBeStringIncludesSome()
  • [x] toBeStringOfLength()
  • [x] toBeStringOfLengthBetween()
  • [x] toBeStringType()

Other

  • [x] toBeRegExp()
  • [x] toBeSymbol()
  • [x] toBeTypeOf()

Expectations based on the are of @angular-package/type and toBe() matcher of jasmine.

  • [x] toBeArrayOfBigInt()
  • [x] toBeArrayOfBoolean()
  • [x] toBeArrayOfDate()
  • [x] toBeArrayOfDefined()
  • [x] toBeArrayOfFalse()
  • [x] toBeArrayOfNull()
  • [x] toBeArrayOfNumber()
  • [x] toBeArrayOfRegExp()
  • [x] toBeArrayOfString()
  • [x] toBeArrayOfSymbol()
  • [x] toBeArrayOfTrue()
  • [x] toBeArrayOfUndefined()

Example

import { Testing, TestingExpectation } from "@angular-package/testing";

const t = new Testing();
const to = new TestingExpectation();  

t.describe(`TestingExpectation`, () => t
  .spec(e => e.toBeArrayOfNull([null, null]))
  .it(`it`, () => to
    .toContain(['a', 'b', 'c'], 'c')
    .toContain('string number', 'ber')
    .toEqual({a: 2}, {a: 2})
    .toMatch("my string", /string$/)
    .toMatch('number', 'ber')

    .not.toContain(['a', 'b', 'c'], 'h')
    .toContain(['a', 'b', 'c'], 'a')

    .not.toBeBigInt('a')
  )
);

It

Prepared specs it of jasmine built. Spec is a method built from it with expectation - expect() and jasmine matcher.

it(description, () => expect(expect).matcher(expected))

Nested

it methods are accessed by using nested object structure and method names.

TestingItTo

Prepared it tests of jasmine.

Nested It objects under specific getter

  • [x] get be(): TestingItToBe
  • [x] get have(): TestingItToHave
  • [x] get throw(): TestingItToThrow

Method

  • [x] contain()
  • [x] equal()
  • [x] match()

Example

import { TestingItTo } from "@angular-package/testing";

const t = new TestingItTo();

// `to{Method}`
t.describe('TestingItTo', () => t
  .contain(['a', 'b', 'c'], 'b')
  .equal(['27', 37, 47], ['27', 37, 47])
  .match("my string", /string$/)
  .match("other string", "ing")
);

// `toBe{Method}`
t.describe('TestingItTo', () => t.be
  .array([27, 37])
  .key(74)
);

// `toBeArrayOf{Method}`
t.describe('TestingItTo', () => t.be.arrayof
  .boolean([false, false])
  .date([new Date(), new Date()])
);

// `toBeBoolean{Method}`
t.describe('TestingItTo', () => t.be.boolean
  .boolean(false)
  .type(false)
);

// `toBeInstanceOf{Method}`
t.describe('TestingItTo', () => t.be.instanceof
  .array([27, 37])
  .map(new Map())
);

// `toHave{Method}`
t.describe('TestingItTo', () => t.have
  .size([27, 37], 2)
);

// `toHaveBeenCalled{Method}`
class ClassA {
  methodA(value?: any) {
    return "methodA";
  }
  methodB(value?: any) {
    return "methodB";
  }
}
let classA: ClassA;
t.describe('TestingItTo', () => t.have.been.called
  .beforeEach(() => {
    classA = new ClassA();
    spyOn(classA, "methodA");
    classA.methodA();
    spyOn(classA, "methodB");
    classA.methodB();
  })
  .called(() => classA.methodA)
  // multiple calls
  .called(() => [classA.methodA, classA.methodB])
);

// `toThrow{Method}`
t.describe('TestingItTo', () => t.throw
  .error(function() { throw new Error('Error') }, 'Error')
  .matching(
    function() { throw new Error('nope'); },
    function(thrown) { return thrown.message === 'nope'; }
  )
  .throw(function() { throw 'things'; }, 'things')
);

TestingItToBe

Nested It objects under specific getter

  • [x] get arrayof(): TestingItToBeArrayOf
  • [x] get boolean(): TestingItToBeBoolean
  • [x] get instanceof(): TestingItToBeInstanceOf

Method

  • [x] be()
  • [x] array()
  • [x] bigInt()
  • [x] class()
  • [x] closeTo()
  • [x] date()
  • [x] defined()
  • [x] false()
  • [x] falsy()
  • [x] function()
  • [x] greaterThan()
  • [x] greaterThanOrEqual()
  • [x] instance()
  • [x] instanceOf()
  • [x] key()
  • [x] lessThan()
  • [x] lessThanOrEqual()
  • [x] naN()
  • [x] negativeInfinity()
  • [x] null()
  • [x] number()
  • [x] numberBetween()
  • [x] numberType()
  • [x] object()
  • [x] objectKey()
  • [x] objectKeyIn()
  • [x] objectKeys()
  • [x] objectKeysIn()
  • [x] objectSomeKeys()
  • [x] positiveInfinity()
  • [x] regExp()
  • [x] pending()
  • [x] rejected()
  • [x] rejectedWith()
  • [x] rejectedWithError()
  • [x] resolved()
  • [x] resolvedTo()
  • [x] string()
  • [x] stringIncludes()
  • [x] stringIncludesSome()
  • [x] stringOfLength()
  • [x] stringOfLengthBetween()
  • [x] stringType()
  • [x] symbol()
  • [x] true()
  • [x] truthy()
  • [x] undefined()

Example

import { TestingItToBe } from "@angular-package/testing";

const t = new TestingItToBe();

t.describe(`TestingItToBe`, () => {
  t
    .arrayof
    .bigint([BigInt(27)])

  t
    .boolean
    .boolean([true, false])
    .type([true, false]);

  t
    .instanceof

  t
    .array([27, 37])
    .bigInt([BigInt(27)])
    .class(t)
    .date(new Date())
    .defined('a')
    .false(false)
    .falsy(false)
    .function(() => {})
    .greaterThan(37, 27)
    .greaterThanOrEqual(37, 37)
    .instance(t, TestingItToBe)
    .instanceOf(t, TestingItToBe)
    .key('PropertyKey')
    .lessThan(37, 47)
    .lessThanOrEqual(47, 47)
    .naN(NaN)
    .negativeInfinity(-Infinity)
    .null(null)
    .number(47)
    .numberBetween(37, 27, 47)
    .numberType(37)
    .object({})
    .objectKey({a: 1}, "a")
    .objectKeyIn(t, "except")

    .objectKeys({a: 1, b: 2}, ["a", "b"])
    .objectKeysIn(t, ["except"])
    // .objectSomeKeys()
    .pending(new Promise((resolve, reject) => {}))

    .positiveInfinity(Infinity)
    .regExp(new RegExp(/a/))
    .rejected(new Promise((resolve, reject) => { reject("a") }))
    .rejectedWith(new Promise((resolve, reject) => { reject("a")}), "a")
    .rejectedWithError(new Promise((resolve, reject) => { throw new Error("Error") }), Error, "Error")

    .resolved(new Promise((resolve, reject) => { resolve("a") }))
    .resolvedTo(new Promise((resolve, reject) => { resolve("a") }), "a")

    .string("a")
    .stringIncludes("a b c d", ["d"])
    .stringIncludesSome(" a b  c d ", ["a", "e", "c"])
    .stringOfLength("a b c d e f g h i j k l m n o p r s", 18)
    .stringOfLengthBetween("a b c d e f g h i j k l m n o p r s", 17, 18)
    .stringType("a b c d e f")
});

TestingItToBeArrayOf

Method

  • [x] bigint()
  • [x] boolean()
  • [x] date()
  • [x] defined()
  • [x] false()
  • [x] null()
  • [x] number()
  • [x] regExp()
  • [x] string()
  • [x] symbol()
  • [x] true()
  • [x] undefined()

Example

import { TestingItToBeArrayOf } from "@angular-package/testing";

const t = new TestingItToBeArrayOf();

t.describe(`TestingItToBeArrayOf`, () => t
  .bigint([BigInt(27), BigInt(37), BigInt(47)])
  .boolean([false, true, false, false, true])
  .date([new Date(), new Date(), new Date(), new Date()])
  .defined(['b', 'c', 'd', 'e'])
  .false([false, false, false, false, false])
  .null([null, null, null])
  .number([27, 37, 47])
  .regExp([new RegExp('a'), new RegExp(/a/), new RegExp('b')])
  .string(['a', 'b', 'c'])
  .symbol([Symbol(27), Symbol('a'), Symbol('b')])
  .true([true, true, true])
  .undefined([undefined, undefined, undefined])
);

TestingItToBeBoolean

import { TestingItToBeBoolean } from "@angular-package/testing";

Method

  • [x] boolean()
  • [x] type()

TestingItToBeInstanceOf

Method

  • [x] array()
  • [x] boolean()
  • [x] date()
  • [x] error()
  • [x] function()
  • [x] map()
  • [x] number()
  • [x] object()
  • [x] promise()
  • [x] rangeError()
  • [x] referenceError()
  • [x] regExp()
  • [x] set()
  • [ ] storage()
  • [x] string()
  • [x] syntaxError()
  • [x] typeError()
  • [x] URIError()
  • [x] weakMap()
  • [x] weakSet()

Example

import { TestingItToBeInstanceOf } from "@angular-package/testing";

const t = new TestingItToBeInstanceOf();

t.describe(`TestingItToBeInstanceOf`, () => t
  .array(['a', 'b', 'c'])
  .boolean(false)
  .date(new Date())
  .error(new Error())
  .function(function() {})
  .map(new Map())
  .number(new Number(27))
  .object(new Object({}))
  .promise(new Promise((resolve, reject) => { resolve('a') }))
  .rangeError(new RangeError('range error'))
  .referenceError(new ReferenceError('reference'))
  .regExp(new RegExp('a'))
  .set(new Set('a'))
  // .storage()
  .string('a')
  .syntaxError(new SyntaxError('syntax error'))
  .typeError(new TypeError('type error'))
  .weakSet(new WeakSet())
);  

TestingItToHave

Nested It object under specific getter

  • [x] get been(): TestingItToHaveBeen

Method

  • [x] class()
  • [x] size()
  • [x] spyInteractions()

Example

import { TestingItToHave } from "@angular-package/testing";

const t = new TestingItToHave();

const el = document.createElement('div');
el.className = 'foo bar baz';

class ClassA {
  public methodA() {
    return "methodA";
  }
}
const classA = new ClassA();

t.describe('TestingItToHave', () => t
  .beforeEach(() => {
    spyOn(classA, "methodA");
    classA.methodA();
  })
  .class(el, 'bar')
  .size(['a', 'b'], 2)
  .spyInteractions(classA)
);

TestingItToHaveBeen

import { TestingItToHaveBeen } from "@angular-package/testing";

TestingItToHaveBeenCalled

Method

  • [x] before()
  • [x] called()
  • [x] onceWith()
  • [x] with()

Example

import { TestingItToHaveBeenCalled } from "@angular-package/testing";

const t = new TestingItToThrow();

t.describe('TestingItToThrow', () => t
  .error(function() { throw new Error('Error') }, 'Error')
  .matching(
    function() { throw new Error('nope'); },
    function(thrown) { return thrown.message === 'nope'; }
  )
  .throw(function() { throw 'things'; }, 'things')
);

TestingItToThrow

Prepared toThrow tests.

Method

  • [x] error()
  • [x] matching()
  • [x] throw()

Standalone

it methods are directly accessed by using method names instead of nested structure, but using it. Standalone tests are designed to mixin them in TestingCustom class.

Example it method with actual param.

public toEqual<T>(
  actual: ExpectType<T>,
  expected: jasmine.Expected<typeof actual>,
  expectation?: string,
  expectationFailOutput?: any,
  execute?: boolean,
): this {
  this.to.equal(actual, expected, expectation, expectationFailOutput, execute);
  return this;
}

Example it method with spy param.

public toHaveBeenCalled<T extends jasmine.Func>(
  spy: () => ExpectType<T> | ExpectType<T>[],
  expectation?: string,
  expectationFailOutput?: any,
  execute?: boolean,
): this {
  this.toHave.been.called.called(spy, expectation, expectationFailOutput, execute);
  return this;
}

TestingToBeArrayOf

Prepared it specs prefixed with testingToBeArrayOf.

  • [x] toBeArrayOfBigInt()
  • [x] toBeArrayOfDate()
  • [x] toBeArrayOfDefined()
  • [x] toBeArrayOfFalse()
  • [x] toBeArrayOfNull()
  • [x] toBeArrayOfRegExp()
  • [x] toBeArrayOfString()
  • [x] toBeArrayOfSymbol()
  • [x] toBeArrayOfTrue()
  • [x] toBeArrayOfUndefined()

TestingToBeBoolean

Prepared it specs prefixed with toBeBoolean.

  • [x] toBeBoolean()
  • [x] toBeBooleanType()

TestingToBeGreaterThan

Prepared it specs prefixed with toBeGreaterThan.

  • [x] toBeGreaterThan()
  • [x] toBeGreaterThanOrEqual()

TestingToBeInstanceOf

Prepared it specs prefixed with toBeInstanceOf.

  • [x] toBeInstanceOfArray()
  • [x] toBeInstanceOfBoolean()
  • [x] toBeInstanceOfDate()
  • [x] toBeInstanceOfError()
  • [x] toBeInstanceOfFunction()
  • [x] toBeInstanceOfMap()
  • [x] toBeInstanceOfNumber()
  • [x] toBeInstanceOfObject()
  • [x] toBeInstanceOfPromise()
  • [x] toBeInstanceOfRangeError()
  • [x] toBeInstanceOfReferenceError()
  • [x] toBeInstanceOfRegExp()
  • [x] toBeInstanceOfSet()
  • [ ] toBeInstanceOfStorage()
  • [x] toBeInstanceOfString()
  • [x] toBeInstanceOfSyntaxError()
  • [x] toBeInstanceOfTypeError()
  • [x] toBeInstanceOfURIError()
  • [x] toBeInstanceOfWeakSet()

TestingToBeLessThan

Prepared it specs prefixed with toBeLessThan.

  • [x] toBeLessThan()
  • [x] toBeLessThanOrEqual()

TestingToBeNumber

Prepared it specs prefixed with toBeNumber.

  • [x] toBeNumber()
  • [x] toBeNumberBetween()
  • [x] toBeNumberType()

TestingToBeObject

Prepared it specs prefixed with toBeObject.

  • [x] toBeObject()
  • [x] toBeObjectKey()
  • [x] toBeObjectKeyIn()
  • [x] toBeObjectKeys()
  • [x] toBeObjectKeysIn()
  • [x] toBeObjectSomeKeys()

TestingToBeString

Prepared it specs prefixed with toBeString.

  • [x] toBeString()
  • [x] toBeStringIncludes()
  • [x] toBeStringIncludesSome()
  • [x] toBeStringOfLength()
  • [x] toBeStringOfLengthBetween()
  • [x] toBeStringType()

TestingToBe

Prepared it specs prefixed with toBe.

  • [x] toBeArray()
  • [x] toBeBigInt()
  • [x] toBeClass()
  • [x] toBeCloseTo()
  • [x] toBeDate()
  • [x] toBeDefined()
  • [x] toBeFalse()
  • [x] toBeFalsy()
  • [x] toBeFunction()
  • [x] toBeInstance()
  • [x] toBeInstanceOf()
  • [x] toBeKey()
  • [x] toBeNaN()
  • [x] toBeNegativeInfinity()
  • [x] toBeNull()
  • [x] toBePending()
  • [x] toBePositiveInfinity()
  • [x] toBeRegExp()
  • [x] toBeRejected()
  • [x] toBeRejectedWith()
  • [x] toBeRejectedWithError()
  • [x] toBeResolved()
  • [x] toBeResolvedTo()
  • [x] toBeSymbol()
  • [x] toBeTrue()
  • [x] toBeTruthy()
  • [x] toBeUndefined()

TestingToHave

Prepared it specs prefixed with toHave.

  • [x] toHaveBeenCalled()
  • [x] toHaveBeenCalledBefore()
  • [x] toHaveBeenCalledOnceWith()
  • [x] toHaveBeenCalledTimes()
  • [x] toHaveBeenCalledWith()
  • [x] toHaveClass()
  • [x] toHaveSize()
  • [x] toHaveSpyInteractions()

TestingToThrow

Prepared it specs prefixed with toThrow.

  • [x] toThrowError()
  • [x] toThrowMatching()

TestingTo

Prepared it specs prefixed with to.

  • [x] toBe()
  • [x] toContain()
  • [x] toEqual()
  • [x] toMatch()
  • [x] toThrow()

Changelog

The changelog of this package is based on keep a changelog. To read it, click on the CHANGELOG.md link.

A changelog is a file which contains a curated, chronologically ordered list of notable changes for each version of a project. - keep a changelog

GIT

Commit

Versioning

Semantic Versioning 2.0.0

Given a version number MAJOR.MINOR.PATCH, increment the:

  • MAJOR version when you make incompatible API changes,
  • MINOR version when you add functionality in a backwards-compatible manner, and
  • PATCH version when you make backwards-compatible bug fixes.

Additional labels for pre-release and build metadata are available as extensions to the MAJOR.MINOR.PATCH format.

FAQ How should I deal with revisions in the 0.y.z initial development phase?

The simplest thing to do is start your initial development release at 0.1.0 and then increment the minor version for each subsequent release.

How do I know when to release 1.0.0?

If your software is being used in production, it should probably already be 1.0.0. If you have a stable API on which users have come to depend, you should be 1.0.0. If you’re worrying a lot about backwards compatibility, you should probably already be 1.0.0.

License

MIT © angular-package (license)

Packages

Useful and simple packages.

| Package | Description | Status | | :------------------------------------------- | :---------------------------------------------------------------- | -----: | | callback | Manages the callback function. | npm version | | change-detection | Improves application performance. | npm version | | component-loader | Handles dynamic loading components. | npm version | | core | Core features. | npm version | | error | Manages an Error. | npm version | | indexeddb | Wrapper to IndexedDB client-side storage. | npm version | | name | The name with prefix and suffix. | inprogress | | preferences | Preferences, settings, options, configuration and setup in steps. | inprogress | | prism | Prism highlighter module. | npm version | | property | Handles object properties. | npm version | | range | The range between a minimum and maximum. | npm version | | reactive | Automatize the process of creating some rxjs features. | npm version | | sass | Extension for sass modules and new modules. | npm version | | sass-list | Modified list Sass module. | npm version | | sass-string | Modified string Sass module. | npm version | | spectre.css | Modified Spectre.css - a lightweight, responsive, and modern CSS framework originally designed by Yan Zhu. | npm version | | storage | The storage of data under allowed names. | inprogress | | tag | Any tag with optional attributes. | inprogress | | testing | Support for testing other packages. | npm version | | text | Text on the template with replaceable tags. | inprogress | | type | Common types, type guards, and type checkers. | npm version | | ui | User interface. | npm version | | wrapper | Wrap the text with the opening and closing chars. | npm version |

Click on the package name to visit its GitHub page.