angular-package/testing

Repository files navigation

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.


@angular-package/testing

Jasmine unit testing wrapper with additional custom testing features.

GitterDiscordTwitter

npm version

GitHub issuesGitHub forksGitHub starsGitHub license

GitHub sponsorsSupport me on Patreon



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.


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.

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

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


Install @angular-package/testing package with command:

npm i --save @angular-package/testing

Dependencies

npm i tslib
npm i jasmine

/**
 * 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';

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)));
});

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})
});

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)
);

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

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

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')
  )
);

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')
  )
);

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))

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

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')
);

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")
});

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])
);
import { TestingItToBeBoolean } from "@angular-package/testing";

Method

  • boolean()
  • type()

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())
);  

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)
);
import { TestingItToHaveBeen } from "@angular-package/testing";

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')
);

Prepared toThrow tests.

Method

  • error()
  • matching()
  • throw()

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;
}

Prepared it specs prefixed with testingToBeArrayOf.

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

Prepared it specs prefixed with toBeBoolean.

  • toBeBoolean()
  • toBeBooleanType()

Prepared it specs prefixed with toBeGreaterThan.

  • toBeGreaterThan()
  • toBeGreaterThanOrEqual()

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()

Prepared it specs prefixed with toBeLessThan.

  • toBeLessThan()
  • toBeLessThanOrEqual()

Prepared it specs prefixed with toBeNumber.

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

Prepared it specs prefixed with toBeObject.

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

Prepared it specs prefixed with toBeString.

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

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()

Prepared it specs prefixed with toHave.

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

Prepared it specs prefixed with toThrow.

  • toThrowError()
  • toThrowMatching()

Prepared it specs prefixed with to.

  • toBe()
  • toContain()
  • toEqual()
  • toMatch()
  • toThrow()

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


Semantic Versioning 2.0.0

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

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

Additional labels for and build metadata are available as extensions to the MAJOR.MINOR. 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.

MIT © angular-package (license)

Useful and simple packages.

PackageDescriptionStatus
callbackManages the callback function.npm version
change-detectionImproves application performance.npm version
component-loaderHandles dynamic loading components.npm version
coreCore features.npm version
errorManages an Error.npm version
indexeddbWrapper to IndexedDB client-side storage.npm version
nameThe name with prefix and suffix.inprogress
preferencesPreferences, settings, options, configuration and setup in steps.inprogress
prismPrism highlighter module.npm version
propertyHandles object properties.npm version
rangeThe range between a minimum and maximum.npm version
reactiveAutomatize the process of creating some rxjs features.npm version
sassExtension for sass modules and new modules.npm version
sass-listModified list Sass module.npm version
sass-stringModified string Sass module.npm version
spectre.cssModified Spectre.css - a lightweight, responsive, and modern CSS framework originally designed by Yan Zhu.npm version
storageThe storage of data under allowed names.inprogress
tagAny tag with optional attributes.inprogress
testingSupport for testing other packages.npm version
textText on the template with replaceable tags.inprogress
typeCommon types, type guards, and type checkers.npm version
uiUser interface.npm version
wrapperWrap the text with the opening and closing chars.npm version

Click on the package name to visit its page.

About

Jasmine unit testing wrapper with additional custom testing features.

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

  •  

Packages

No packages published

Contributors 2

  •  
  •