Skip to content

Commit

Permalink
(test): ensure error in node env w/ localStorage
Browse files Browse the repository at this point in the history
- add node test to reach 100% code coverage!

- would prefer this test be in the same file as the others, but
  unfortunately jest only allows setting jest-environment on a per
  file basis, not on a per test or per test suite basis :/
  • Loading branch information
agilgur5 committed Nov 19, 2019
1 parent 96f9acc commit 46965e1
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions test/index.node.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/**
* @jest-environment node
*/
// add tests in this file that are specific to node (vs. jsdom)

/// <reference types="@types/jest" />

import { persist } from '../src/index'
import { UserStoreF } from './fixtures'

describe('node usage', () => {
it('should error on default localStorage usage', async () => {
const user = UserStoreF.create()
await expect(persist('user', user)).rejects.toMatch(/^localStorage.+$/)
})
})

0 comments on commit 46965e1

Please sign in to comment.