Skip to content

Commit 805e2fa

Browse files
docs(README.md): update
1 parent 4cdf854 commit 805e2fa

1 file changed

Lines changed: 66 additions & 2 deletions

File tree

README.md

Lines changed: 66 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Everything to support testing.
3434

3535
* [Skeleton](#skeleton)
3636
* [Installation](#installation)
37-
* [instanceof](#instanceof)
37+
* [Instance of](#instanceof)
3838
* [Testing](#testing)
3939
* [Constants](#constants)
4040
* [Git](#git)
@@ -177,7 +177,7 @@ Simple object to support the testing.
177177
| [`toBeInstanceOfString()`](#testingprototypetobeinstanceofstring) | Executes the spec on a state `true` from the `execute` expecting the provided `value` to be an instance of a [`String`][js-string] on the given `expected` state of `true` |
178178
| [`toBeInstanceOfSyntaxError()`](#testingprototypetobeinstanceofsyntaxerror) | Executes the spec on a state `true` from the `execute` expecting the provided `value` to be an instance of [`SyntaxError`][js-syntaxerror] on the given `expected` state of `true` |
179179
| [`toBeInstanceOfTypeError()`](#testingprototypetobeinstanceoftypeerror) | Executes the spec on a state `true` from the `execute` expecting the provided `value` to be an instance of [`TypeError`][js-typeerror] on the given `expected` state of `true` |
180-
| [`toBeInstanceOfURIError()`](#testingprototypetobeinstanceofurlerror) | Executes the spec on a state `true` from the `execute` expecting the provided `value` to be an instance of [`URIError`][js-urlerror] on the given `expected` state of `true` |
180+
| [`toBeInstanceOfURIError()`](#testingprototypetobeinstanceofurierror) | Executes the spec on a state `true` from the `execute` expecting the provided `value` to be an instance of [`URIError`][js-urlerror] on the given `expected` state of `true` |
181181
| [`toBeInstanceOfWeakSet()`](#testingprototypetobeinstanceofweakset) | Executes the spec on a state `true` from the `execute` expecting the provided `value` to be an instance of a [`WeakSet`][js-weakset] on the given `expected` state of `true` |
182182
| [`toBeNull()`](#testingprototypetobenull) | Executes the spec on a state `true` from the `execute` expecting the provided `value` to be [`null`][js-null] on the given `expected` state of `true` |
183183
| [`toBeNumberType()`](#testingprototypetobenumbertype) | Executes the spec on a state `true` from the `execute` expecting the provided `value` to be of a [`number`][js-number] type on the given `expected` state of `true` |
@@ -281,6 +281,17 @@ testing.describe('[counter] Fifth describe', () =>
281281
expect(false).toBeFalse()
282282
)
283283
);
284+
/*
285+
Karma returns
286+
1 First describe
287+
1 First it() in first describe 1-1
288+
3 Third describe()
289+
1 First it() in third describe() 3-1
290+
2 Second describe()
291+
1 First it() in second describe() 2-1
292+
5 Fifth describe
293+
1 First it() in fifth describe 5-1
294+
*/
284295
```
285296

286297
<br>
@@ -1783,8 +1794,60 @@ const testing = new Testing(true, true);
17831794
testing.describe(`string`, () => testing.toBeStringType('my name'));
17841795
```
17851796

1797+
### `Testing.prototype.toEqual()`
1798+
1799+
Executes the spec on a state `true` from the `execute` expecting the provided `value` to equal to the given `expected`.
1800+
1801+
> "Expect the actual `value` to be equal to the `expected`, using deep equality comparison."
1802+
1803+
```typescript
1804+
public toEqual(
1805+
expectation: string,
1806+
value: any,
1807+
expected: any,
1808+
execute?: boolean
1809+
): this {
1810+
this.it(expectation, () => expect(value).toEqual(expected), execute);
1811+
return this;
1812+
}
1813+
```
1814+
1815+
**Parameters:**
1816+
1817+
| Name: type | Description |
1818+
| :-------------------- | :---------- |
1819+
| `expectation: string` | "Textual description of what this spec is checking" with an optional its unique number when adding `[counter]` |
1820+
| `value: Value` | The value of any type passed to the [`expect()`][jasmine-expect] function of jasmine |
1821+
| `expected: boolean` | The value of any type passed to the `toEqual()` method of jasmine. "The expected value to compare against." |
1822+
| `execute: boolean` | Whether or not to execute the spec, by default it's set to `true` |
1823+
1824+
**Returns:**
1825+
1826+
The **return value** is an instance of a [`Testing`](#testing).
1827+
1828+
**Usage:**
1829+
1830+
```typescript
1831+
// Example usage.
1832+
// Class.
1833+
import { Testing } from '@angular-package/testing';
1834+
/**
1835+
* Initialize testing.
1836+
*/
1837+
const testing = new Testing(true, true);
1838+
/**
1839+
* toEqual()
1840+
*/
1841+
const firstName = 'My name';
1842+
testing.describe(`toEqual`, () => testing.toEqual('Expects `firstName` to equal to `My name`', firstName, 'My name'));
1843+
```
1844+
1845+
<br>
1846+
17861847
## Constants
17871848

1849+
Constants prepared for testing purposes.
1850+
17881851
### `Array`
17891852

17901853
```typescript
@@ -2422,6 +2485,7 @@ MIT © angular-package ([license][testing-license])
24222485

24232486
<!-- Jasmine -->
24242487
[jasmine-describe]: https://jasmine.github.io/api/3.8/global.html#describe
2488+
[jasmine-expect]: https://jasmine.github.io/api/3.8/global.html#expect
24252489
[jasmine-it]: https://jasmine.github.io/api/3.8/global.html#it
24262490

24272491
<!-- Javascript -->

0 commit comments

Comments
 (0)