Skip to content

Commit

Permalink
Added a huge demo gif, removed an unnecessary linting exception.
Browse files Browse the repository at this point in the history
  • Loading branch information
Dean177 committed Jan 15, 2018
1 parent dfd3ad2 commit c3d4f30
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
2 changes: 2 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

A [Jest matcher](https://facebook.github.io/jest/docs/en/using-matchers.html) to verify the structure of an object, particularly useful for api integration tests

![example-gif](./example/huge-demo-gif.gif)

## Installation

```bash
Expand Down
Binary file added example/huge-demo-gif.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 3 additions & 4 deletions src/toBeTypeOf.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import * as util from 'jest-matcher-utils'
import * as getType from 'jest-get-type'
import { printExpected, printReceived } from 'jest-matcher-utils'
import { matcherHint, printExpected, printReceived } from 'jest-matcher-utils'
import { JestResult } from './common-types'
import MatcherUtils = jest.MatcherUtils

Expand All @@ -17,8 +16,8 @@ export function toBeTypeOf <T>(this: MatcherUtils, actual: T, expected: T): Jest

return {
message: () => pass ? '' :
util.matcherHint('.toBeTypeOf') +
'\n\n' +
`${matcherHint('.toBeTypeOf')}\n` +
`\n` +
`Received:\n` +
` ${printReceived(getType(actual))}\n` +
`Expected:\n` +
Expand Down
1 change: 0 additions & 1 deletion src/toMatchOneOf.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// tslint:disable:no-any
import { toMatchOneOf } from './toMatchOneOf'

describe('toMatchOneOf', () => {
Expand Down
8 changes: 4 additions & 4 deletions src/toMatchOneOf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ const successResult = {

// tslint:disable-next-line:no-any
export const formatError = (received: any, expectedTypes: Array<string>, keys: Array<string>): string => (
util.matcherHint('.toMatchShapeOf') +
'\n\n' +
`${util.matcherHint('.toMatchShapeOf')}\n` +
`\n` +
`For${(keys.length === 0) ? '' : ' received' + keys.join('')}:\n` +
` type: ${util.printReceived(getType(received))}\n` +
` type: ${util.RECEIVED_COLOR(getType(received))}\n` +
` value: ${util.printReceived(received)}\n` +
`Expected type to be one of\n` +
` ${util.printExpected(`[${expectedTypes.join(', ')}]`)}\n`
` ${util.EXPECTED_COLOR(`${expectedTypes.join(', ')}`)}\n`
)

export function toMatchOneOf<T extends {}>(
Expand Down

0 comments on commit c3d4f30

Please sign in to comment.