import { createCookieStore } from '../../src/storage'
import Cookie from 'js-cookie'

describe('cookie store', () => {
  describe('#persist', () => {
    it('returns resolved promise', () => {
      const cookieStore = createCookieStore()

      expect(cookieStore.persist()).resolves
    })

    it('saves data to cookie with default key', () => {
      const cookieStore = createCookieStore()
      const spy = jest.spyOn(Cookie, 'set')

      cookieStore.persist({ key: 'value' })

      expect(spy).toHaveBeenCalledWith(
        'redux-simple-auth-session',
        { key: 'value' },
        { domain: null, expires: null, path: '/', secure: false }
      )
    })
  })
})

import { createCookieStore } from '../../src/storage'
import Cookie from 'js-cookie'

describe('cookie store', () => {
  describe('#persist', () => {
    it('returns resolved promise', () => {
      const cookieStore = createCookieStore()

      expect(cookieStore.persist()).resolves
    })

    it('saves data to cookie with default key', () => {
      const cookieStore = createCookieStore()
      const spy = jest.spyOn(Cookie, 'set')

      cookieStore.persist({ key: 'value' })

      expect(spy).toHaveBeenCalledWith(
        'redux-simple-auth-session',
        { key: 'value' },
        { domain: null, expires: null, path: '/', secure: false }
      )
    })

    xit('allows a configured cookie name')
    xit('allows a custom path')
    xit('allows a custom domain')
    xit('allows setting expiration')
    xit('allows setting secure cookie')
  })
})

Add tests to be implemented for persist
Add tests to be implemented for persist
