diff --git a/package.json b/package.json index cb7576dc8..2ac12d065 100644 --- a/package.json +++ b/package.json @@ -161,4 +161,4 @@ "lint": "eslint ./src --ext .ts", "format": "prettier --write ." } -} \ No newline at end of file +} diff --git a/src/compat/_internal/isIndex.spec.ts b/src/compat/_internal/isIndex.spec.ts index 7d16c8466..735ea7b4c 100644 --- a/src/compat/_internal/isIndex.spec.ts +++ b/src/compat/_internal/isIndex.spec.ts @@ -1,8 +1,6 @@ - import { describe, expect, it } from 'vitest'; import { isIndex } from './isIndex'; - describe('isIndex', () => { it('should return `true` for indices', () => { expect(isIndex(0)).toBe(true); @@ -18,5 +16,6 @@ describe('isIndex', () => { expect(isIndex(-1)).toBe(false); expect(isIndex(1.1)).toBe(false); expect(isIndex(Number.MAX_SAFE_INTEGER)).toBe(false); + expect(isIndex(Symbol('a'))).toBe(false); }); }); diff --git a/src/compat/array/chunk.spec.ts b/src/compat/array/chunk.spec.ts index fc59603c2..2e86b2eab 100644 --- a/src/compat/array/chunk.spec.ts +++ b/src/compat/array/chunk.spec.ts @@ -23,6 +23,11 @@ describe('chunk', () => { ]); }); + it('has default size of 1', () => { + const actual = chunk(array); + expect(actual).toEqual([[0], [1], [2], [3], [4], [5]]); + }); + it('should ensure the minimum `size` is `0`', () => { expect(chunk([1, 2, 3], -1)).toEqual([]); expect(chunk([1, 2, 3], -2)).toEqual([]); diff --git a/src/compat/math/max.spec.ts b/src/compat/math/max.spec.ts index 2eb0a870a..ec0f75164 100644 --- a/src/compat/math/max.spec.ts +++ b/src/compat/math/max.spec.ts @@ -1,10 +1,10 @@ -import { describe, expect, it } from "vitest"; -import { max } from "./max"; - +import { describe, expect, it } from 'vitest'; +import { max } from './max'; describe('max', () => { it('should return the largest value from a collection', () => { expect(max([1, 2, 3])).toBe(3); + expect(max([1, 3, 2])).toBe(3); }); it('should return `undefined` for empty collections', () => { diff --git a/src/compat/object/set.spec.ts b/src/compat/object/set.spec.ts index 755f2b1da..9937f3919 100644 --- a/src/compat/object/set.spec.ts +++ b/src/compat/object/set.spec.ts @@ -19,6 +19,11 @@ describe('set', () => { expect(result).toEqual({ a: { b: 1 } }); }); + it('should set a value on an object with paths with arrays', () => { + const result = set<{ a: { b: number } }>({}, ['a', 'b'], 1); + expect(result).toEqual({ a: { b: 1 } }); + }); + it('should set a value on an object with nested path', () => { const result = set<{ a: { b: { c: { d: number } } } }>({}, 'a.b.c.d', 1); expect(result).toEqual({ a: { b: { c: { d: 1 } } } }); diff --git a/vitest.config.mts b/vitest.config.mts index 58ec44477..4972917e5 100644 --- a/vitest.config.mts +++ b/vitest.config.mts @@ -4,12 +4,11 @@ import packageJson from './package.json'; export default defineConfig({ test: { name: packageJson.name, - exclude: [ - './benchmarks/**/*' - ], + exclude: ['./benchmarks/**/*'], coverage: { provider: 'istanbul', include: ['src/**/*'], + exclude: ['src/browser.ts'], }, }, });