Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update test #29

Merged
merged 3 commits into from
Aug 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading