Skip to content

Commit

Permalink
test: Add missing test lines
Browse files Browse the repository at this point in the history
  • Loading branch information
raon0211 committed Jul 20, 2024
1 parent 0efffb6 commit cc06b2d
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 9 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -161,4 +161,4 @@
"lint": "eslint ./src --ext .ts",
"format": "prettier --write ."
}
}
}
3 changes: 1 addition & 2 deletions src/compat/_internal/isIndex.spec.ts
Original file line number Diff line number Diff line change
@@ -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);
Expand All @@ -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);
});
});
5 changes: 5 additions & 0 deletions src/compat/array/chunk.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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([]);
Expand Down
6 changes: 3 additions & 3 deletions src/compat/math/max.spec.ts
Original file line number Diff line number Diff line change
@@ -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', () => {
Expand Down
5 changes: 5 additions & 0 deletions src/compat/object/set.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 } } } });
Expand Down
5 changes: 2 additions & 3 deletions vitest.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
},
},
});

0 comments on commit cc06b2d

Please sign in to comment.