Skip to content

Commit

Permalink
Make debugging work
Browse files Browse the repository at this point in the history
  • Loading branch information
mweststrate committed Dec 29, 2017
1 parent 1637393 commit d0ef4ed
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 2 deletions.
21 changes: 21 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
// Note; this config requires node 8.4 or higher
"type": "node",
"protocol": "inspector",
"request": "launch",
"name": "debug unit test",
"stopOnEntry": false,
"program": "${workspaceRoot}/node_modules/jest-cli/bin/jest.js",
"args": ["-i", "${file}"],
"runtimeArgs": [
"--nolazy"
]
}
]
}
30 changes: 28 additions & 2 deletions __tests__/base.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,31 @@
import immer from ".."

test("base", () => {
expect(true).toBe(true)
describe("base", () => {
let baseState

beforeEach(() => {
baseState = createBaseState()
})

it("should return the original without modifications", () => {
const nextState = immer(baseState, () => {})
expect(nextState).toBe(baseState)
})

afterEach(() => {
expect(baseState).toEqual(createBaseState())
})
})

function createBaseState() {
return {
anArray: [1, 2, { c: 3 }],
aProp: "hi",
anObject: {
nested: {
yummie: true
},
coffee: false
}
}
}

0 comments on commit d0ef4ed

Please sign in to comment.