Skip to content

Jasmine unit testing wrapper with additional custom testing features.

License

Notifications You must be signed in to change notification settings

angular-package/testing

Repository files navigation

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.

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

Expectations based on the instanceOf matcher of jasmine.

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

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

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

Number

  • toBeNumber()
  • toBeNumberBetween()
  • toBeNumberType()

Object

  • toBeObject()
  • toBeObjectKey()
  • toBeObjectKeyIn()
  • toBeObjectKeys()
  • toBeObjectKeysIn()
  • toBeObjectSomeKeys()

String

  • toBeString()
  • toBeStringIncludes()
  • toBeStringIncludesSome()
  • toBeStringOfLength()
  • toBeStringOfLengthBetween()
  • toBeStringType()

Other

  • toBeRegExp()
  • toBeSymbol()
  • toBeTypeOf()

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

  • toBeArrayOfBigInt()
  • toBeArrayOfBoolean()
  • toBeArrayOfDate()
  • toBeArrayOfDefined()
  • toBeArrayOfFalse()
  • toBeArrayOfNull()
  • toBeArrayOfNumber()
  • toBeArrayOfRegExp()
  • toBeArrayOfString()
  • toBeArrayOfSymbol()
  • toBeArrayOfTrue()
  • 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

  • get be(): TestingItToBe
  • get have(): TestingItToHave
  • get throw(): TestingItToThrow

Method

  • contain()
  • equal()
  • 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

  • get arrayof(): TestingItToBeArrayOf
  • get boolean(): TestingItToBeBoolean
  • get instanceof(): TestingItToBeInstanceOf

Method

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

  • bigint()
  • boolean()
  • date()
  • defined()
  • false()
  • null()
  • number()
  • regExp()
  • string()
  • symbol()
  • true()
  • 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

  • boolean()
  • type()

TestingItToBeInstanceOf

Method

  • array()
  • boolean()
  • date()
  • error()
  • function()
  • map()
  • number()
  • object()
  • promise()
  • rangeError()
  • referenceError()
  • regExp()
  • set()
  • storage()
  • string()
  • syntaxError()
  • typeError()
  • URIError()
  • weakMap()
  • 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

  • get been(): TestingItToHaveBeen

Method

  • class()
  • size()
  • 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

  • before()
  • called()
  • onceWith()
  • 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

  • error()
  • matching()
  • 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.

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

TestingToBeBoolean

Prepared it specs prefixed with toBeBoolean.

  • toBeBoolean()
  • toBeBooleanType()

TestingToBeGreaterThan

Prepared it specs prefixed with toBeGreaterThan.

  • toBeGreaterThan()
  • toBeGreaterThanOrEqual()

TestingToBeInstanceOf

Prepared it specs prefixed with toBeInstanceOf.

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

TestingToBeLessThan

Prepared it specs prefixed with toBeLessThan.

  • toBeLessThan()
  • toBeLessThanOrEqual()

TestingToBeNumber

Prepared it specs prefixed with toBeNumber.

  • toBeNumber()
  • toBeNumberBetween()
  • toBeNumberType()

TestingToBeObject

Prepared it specs prefixed with toBeObject.

  • toBeObject()
  • toBeObjectKey()
  • toBeObjectKeyIn()
  • toBeObjectKeys()
  • toBeObjectKeysIn()
  • toBeObjectSomeKeys()

TestingToBeString

Prepared it specs prefixed with toBeString.

  • toBeString()
  • toBeStringIncludes()
  • toBeStringIncludesSome()
  • toBeStringOfLength()
  • toBeStringOfLengthBetween()
  • toBeStringType()

TestingToBe

Prepared it specs prefixed with toBe.

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

TestingToHave

Prepared it specs prefixed with toHave.

  • toHaveBeenCalled()
  • toHaveBeenCalledBefore()
  • toHaveBeenCalledOnceWith()
  • toHaveBeenCalledTimes()
  • toHaveBeenCalledWith()
  • toHaveClass()
  • toHaveSize()
  • toHaveSpyInteractions()

TestingToThrow

Prepared it specs prefixed with toThrow.

  • toThrowError()
  • toThrowMatching()

TestingTo

Prepared it specs prefixed with to.

  • toBe()
  • toContain()
  • toEqual()
  • toMatch()
  • 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.