2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

jestで返り値の型が配列であることを検証したい時に書くコード

Posted at

ビルトインのArray.isArray()を利用することで検証可能

describe('hogeMethod', () => {
  it('return empty array if hogehoge', () => {
    const hogeArray = hogeMethod('hogehogehoge')
    expect(Array.isArray(hogeArray)).toBe(true)
    expect(_.isEmpty).toBe(true)
  })
})
2
1
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?