Tests should thoroughly cover all code paths and edge cases. Each test case should: 1. Test distinct scenarios in separate test cases 2. Cover all logical branches and code paths
Tests should thoroughly cover all code paths and edge cases. Each test case should:
Example:
// โ Incomplete test coverage
test('isRef check', () => {
expect(isRef(computed(() => 1))).toBe(true)
})
// โ
Comprehensive test coverage
describe('isRef', () => {
test('returns true for computed values', () => {
expect(isRef(computed(() => 1))).toBe(true)
})
test('returns false for primitive values', () => {
expect(isRef(0)).toBe(false)
expect(isRef(1)).toBe(false) // Test truthy primitive
expect(isRef('')).toBe(false) // Test falsy primitive
})
test('returns true for ref values', () => {
expect(isRef(ref(1))).toBe(true)
expect(isRef(ref(null))).toBe(true)
})
})
Enter the URL of a public GitHub repository