Skip to content

Commit

Permalink
Merge pull request #29 from chrisvander/update-test
Browse files Browse the repository at this point in the history
update test
  • Loading branch information
chrisvander authored Aug 22, 2024
2 parents 8b03c30 + 38f9c3b commit ba059e8
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 38 deletions.
Binary file modified bun.lockb
Binary file not shown.
2 changes: 1 addition & 1 deletion commitlint.config.mjs
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export default { extends: ["@commitlint/config-conventional"] };
export default { extends: ["@commitlint/config-conventional"] }
51 changes: 18 additions & 33 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,33 +1,16 @@
{
"name": "zustand-computed",
"version": "1.4.1",
"description": "A Zustand middleware to create computed states.",
"author": "chrisvander",
"license": "MIT",
"repository": "chrisvander/zustand-computed",
"main": "dist/index.js",
"module": "dist/index.mjs",
"exports": {
".": {
"import": "./dist/index.js",
"require": "./dist/index.mjs"
}
},
"repository": "chrisvander/zustand-computed",
"files": [
"/dist"
],
"scripts": {
"check": "biome check --write",
"format": "biome format --write",
"lint": "biome lint",
"build": "vite build"
},
"devDependencies": {
"@biomejs/biome": "^1.8.3",
"@commitlint/cli": "^19.4.0",
"@commitlint/config-conventional": "^19.2.2",
"@tsconfig/recommended": "^1.0.7",
"@types/jest": "^29.5.12",
"@tsconfig/bun": "^1.0.7",
"@types/bun": "^1.1.6",
"@types/node": "^22.5.0",
"husky": "^9.1.5",
"react": "^18.3.1",
Expand All @@ -41,18 +24,20 @@
"react": "^18.2.0",
"zustand": "^4.3.8"
},
"keywords": [
"zustand",
"computed",
"calculated",
"state",
"react",
"plugin",
"middleware",
"npm",
"typescript"
],
"dependencies": {
"@tsconfig/bun": "^1.0.7"
"exports": {
".": {
"import": "./dist/index.js",
"require": "./dist/index.mjs"
}
},
"description": "A Zustand middleware to create computed states.",
"files": ["/dist"],
"keywords": ["zustand", "computed", "calculated", "state", "react", "plugin", "middleware", "npm", "typescript"],
"license": "MIT",
"scripts": {
"check": "biome check --write",
"format": "biome format --write",
"lint": "biome lint",
"build": "vite build"
}
}
9 changes: 5 additions & 4 deletions src/computed.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, expect, test, beforeEach, mock } from "bun:test"
import { type StateCreator, create } from "zustand"
import { type ComputedStateOpts, computed } from "./computed"

Expand Down Expand Up @@ -28,7 +29,7 @@ function computeState(state: Store): ComputedStore {
}

describe("default config", () => {
const computeStateMock = jest.fn(computeState)
const computeStateMock = mock(computeState)
const makeStore = () =>
create<Store, [["chrisvander/zustand-computed", ComputedStore]]>(
computed(
Expand All @@ -45,7 +46,7 @@ describe("default config", () => {

let useStore: ReturnType<typeof makeStore>
beforeEach(() => {
jest.clearAllMocks()
computeStateMock.mockClear()
useStore = makeStore()
})

Expand Down Expand Up @@ -86,7 +87,7 @@ describe("default config", () => {
})

describe("custom config", () => {
const computeStateMock = jest.fn(computeState)
const computeStateMock = mock(computeState)
const makeStore = (opts?: ComputedStateOpts<Store>) =>
create<Store, [["chrisvander/zustand-computed", ComputedStore]]>(
computed(
Expand Down Expand Up @@ -147,7 +148,7 @@ function computeSlice(state: CountSlice): ComputedStore {
}

describe("slices pattern", () => {
const computeSliceMock = jest.fn(computeSlice)
const computeSliceMock = mock(computeSlice)
const makeStore = () => {
const createCountSlice: StateCreator<
Store,
Expand Down

0 comments on commit ba059e8

Please sign in to comment.