Skip to content

Commit

Permalink
Add t.assert() to type definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
novemberborn committed Mar 27, 2019
1 parent 20db474 commit a7605de
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
11 changes: 11 additions & 0 deletions index.d.ts
Expand Up @@ -29,6 +29,9 @@ export type SnapshotOptions = {
};

export interface Assertions {
/** Assert that `actual` is [truthy](https://developer.mozilla.org/en-US/docs/Glossary/Truthy). Comes with power-assert. */
assert: AssertAssertion;

/** Assert that `actual` is [deeply equal](https://github.com/concordancejs/concordance#comparison-details) to `expected`. */
deepEqual: DeepEqualAssertion;

Expand Down Expand Up @@ -96,6 +99,14 @@ export interface Assertions {
truthy: TruthyAssertion;
}

export interface AssertAssertion {
/** Assert that `actual` is [truthy](https://developer.mozilla.org/en-US/docs/Glossary/Truthy). Comes with power-assert. */
(actual: any, message?: string): void;

/** Skip this assertion. */
skip(actual: any, message?: string): void;
}

export interface DeepEqualAssertion {
/** Assert that `actual` is [deeply equal](https://github.com/concordancejs/concordance#comparison-details) to `expected`. */
<ValueType = any>(actual: ValueType, expected: ValueType, message?: string): void;
Expand Down
11 changes: 11 additions & 0 deletions index.js.flow
Expand Up @@ -42,6 +42,9 @@ export type SnapshotOptions = {
};

export interface Assertions {
/** Assert that `actual` is [truthy](https://developer.mozilla.org/en-US/docs/Glossary/Truthy). Comes with power-assert. */
assert: AssertAssertion;

/** Assert that `actual` is [deeply equal](https://github.com/concordancejs/concordance#comparison-details) to `expected`. */
deepEqual: DeepEqualAssertion;

Expand Down Expand Up @@ -109,6 +112,14 @@ export interface Assertions {
truthy: TruthyAssertion;
}

export interface AssertAssertion {
/** Assert that `actual` is [truthy](https://developer.mozilla.org/en-US/docs/Glossary/Truthy). Comes with power-assert. */
(actual: any, message?: string): void;

/** Skip this assertion. */
skip(actual: any, message?: string): void;
}

export interface DeepEqualAssertion {
/** Assert that `actual` is [deeply equal](https://github.com/concordancejs/concordance#comparison-details) to `expected`. */
(actual: any, expected: any, message?: string): void;
Expand Down

0 comments on commit a7605de

Please sign in to comment.