# JavaScript Test with Trivial Always-Passing Assertion - ID: javascript-trivial-test-assertion - Severity: MEDIUM - CWE: CWE-670 (CWE-670) - Languages: JavaScript, TypeScript - Frameworks: nodejs, express, fastify, koa, hapi, nextjs ## Description Detects JavaScript test functions that only contain trivial assertions or no assertions at all. These tests provide no actual validation and give false confidence about code correctness. Common patterns include expect(true).toBe(true), assert(true), or tests with only comments. ## Detection Message Test contains trivial assertions like expect(true).toBe(true) or assert(true) that always pass. This test provides no actual validation of the code under test and can hide bugs. Tests should validate actual behavior, not just exist to increase coverage metrics. ## Remediation Replace trivial assertions with meaningful test logic: ```javascript it('should process data correctly', () => { const result = processData(testInput); expect(result.status).toBe('success'); expect(result.data).toHaveLength(3); expect(result.data[0].id).toBeDefined(); }); ``` Learn more: https://shoulder.dev/learn/javascript/cwe-670/trivial-test-assertion