Skip to content

Commit 636426f

Browse files
committed
test: drop vacuous assertions across types, zod, logger-default, signal-exit
- types.test.mts: drop tautological PURL_Type toBeDefined - zod.test.mts: drop tautological z toBeDefined and typeof function checks (real behavior tests remain) - logger-default.test.mts: drop log toBeDefined (typeof function checks suffice for dynamic methods) - signal-exit.test.mts: drop redundant if (sigs) guards after toBeTruthy assertion
1 parent aaa3567 commit 636426f

File tree

4 files changed

+9
-25
lines changed

4 files changed

+9
-25
lines changed

test/unit/logger-default.test.mts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ import { getDefaultLogger } from '@socketsecurity/lib/logger'
1313
import { describe, expect, it } from 'vitest'
1414

1515
describe('getDefaultLogger', () => {
16-
it('should return a Logger instance', () => {
16+
it('should return a Logger with dynamic log methods', () => {
1717
const log = getDefaultLogger()
18-
expect(log).toBeDefined()
18+
// Logger methods are installed dynamically; verify core methods exist.
1919
expect(typeof log.log).toBe('function')
2020
expect(typeof log.success).toBe('function')
2121
expect(typeof log.error).toBe('function')

test/unit/signal-exit.test.mts

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -91,18 +91,16 @@ describe('signal-exit', () => {
9191
load()
9292
const sigs = signals()
9393
expect(sigs).toBeTruthy()
94-
if (sigs) {
95-
// Common signals across platforms
96-
expect(sigs).toContain('SIGINT')
97-
expect(sigs).toContain('SIGTERM')
98-
}
94+
// Common signals across platforms
95+
expect(sigs).toContain('SIGINT')
96+
expect(sigs).toContain('SIGTERM')
9997
})
10098

10199
it('should have platform-specific signals', () => {
102100
load()
103101
const sigs = signals()
104102
expect(sigs).toBeTruthy()
105-
if (sigs && process.platform !== 'win32') {
103+
if (process.platform !== 'win32') {
106104
// POSIX-only signals
107105
expect(sigs.length).toBeGreaterThan(5)
108106
}
@@ -246,7 +244,7 @@ describe('signal-exit', () => {
246244
load()
247245
const sigs = signals()
248246
expect(sigs).toBeTruthy()
249-
if (process.platform === 'win32' && sigs) {
247+
if (process.platform === 'win32') {
250248
// Windows should have fewer signals
251249
expect(sigs).toContain('SIGINT')
252250
expect(sigs).toContain('SIGTERM')
@@ -257,7 +255,7 @@ describe('signal-exit', () => {
257255
load()
258256
const sigs = signals()
259257
expect(sigs).toBeTruthy()
260-
if (process.platform !== 'win32' && sigs) {
258+
if (process.platform !== 'win32') {
261259
// POSIX should have more signals
262260
expect(sigs.length).toBeGreaterThan(5)
263261
expect(sigs).toContain('SIGINT')
@@ -270,7 +268,7 @@ describe('signal-exit', () => {
270268
load()
271269
const sigs = signals()
272270
expect(sigs).toBeTruthy()
273-
if (process.platform === 'linux' && sigs) {
271+
if (process.platform === 'linux') {
274272
// Linux-specific signals
275273
expect(sigs).toContain('SIGIO')
276274
expect(sigs).toContain('SIGPOLL')

test/unit/types.test.mts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,6 @@ import { PURL_Type } from '@socketsecurity/lib/types'
88

99
describe('types', () => {
1010
describe('PURL_Type enum', () => {
11-
it('should export PURL_Type enum', () => {
12-
expect(PURL_Type).toBeDefined()
13-
})
14-
1511
it('should have NPM type', () => {
1612
expect(PURL_Type.NPM).toBe('npm')
1713
})

test/unit/zod.test.mts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,31 +16,22 @@ import { z } from '@socketsecurity/lib/zod'
1616

1717
describe('zod', () => {
1818
describe('z export', () => {
19-
it('should export z object', () => {
20-
expect(z).toBeDefined()
21-
expect(typeof z).toBe('object')
22-
})
23-
2419
it('should export string schema builder', () => {
25-
expect(typeof z.string).toBe('function')
2620
const schema = z.string()
2721
expect(schema.parse('test')).toBe('test')
2822
})
2923

3024
it('should export number schema builder', () => {
31-
expect(typeof z.number).toBe('function')
3225
const schema = z.number()
3326
expect(schema.parse(123)).toBe(123)
3427
})
3528

3629
it('should export boolean schema builder', () => {
37-
expect(typeof z.boolean).toBe('function')
3830
const schema = z.boolean()
3931
expect(schema.parse(true)).toBe(true)
4032
})
4133

4234
it('should export object schema builder', () => {
43-
expect(typeof z.object).toBe('function')
4435
const schema = z.object({
4536
name: z.string(),
4637
age: z.number(),
@@ -52,7 +43,6 @@ describe('zod', () => {
5243
})
5344

5445
it('should export array schema builder', () => {
55-
expect(typeof z.array).toBe('function')
5646
const schema = z.array(z.string())
5747
expect(schema.parse(['a', 'b', 'c'])).toEqual(['a', 'b', 'c'])
5848
})

0 commit comments

Comments
 (0)