bryceosterhaus / atom-jest-snippets

:atom: :black_joker: Atom editor snippets for Jest
https://atom.io/packages/atom-jest-snippets
11 stars 9 forks source link

Complete jest test snippet #2

Closed ahoseinian closed 7 years ago

ahoseinian commented 7 years ago

I was wondering if you like the following snippet to be added to this repo and if I can make a PR for that?

  'jtest':
    description: 'jest test'
    prefix: 'jtest'
    body: """
      import React from 'react'
      import {shallow} from 'enzyme'
      import $1 from './$1'

      describe('$1', () => {
        it('$2', () => {
          const wrapper = shallow(<$1 />)

        })
      })

    """

we can change the prefix as you wish

bryceosterhaus commented 7 years ago

How about leaving out the enzyme and react imports since those are react specific, and not mandatory for jest.

I am thinking something like

  'jsetup':
    description: 'Sets up jest test file'
    prefix: 'jsetup'
    body: """
      import $1 from './$1'

      describe('$1', () => {
        test('$2', () => {
            $3
        })
      })

    """

I would prefer this package to be as generic as possible, usable for any jest tests, not just for jest within a specific framework. If that sounds good to you, go ahead and send a pr.

ahoseinian commented 7 years ago

yeah that seems perfect given that you want to keep this repo generic to jest. I will make a PR asap.

bryceosterhaus commented 7 years ago

merged pr and released v1.0.2