Testing Console Log Normalization in uni-app
This test suite validates the console logging functionality in uni-app, specifically focusing on the log normalization process. It ensures proper formatting and handling of different data types in console output messages, which is crucial for debugging and development workflows.
Test Coverage Overview
Implementation Analysis
Technical Details
Best Practices Demonstrated
dcloudio/uni-app
packages/uni-app-plus/__tests__/hbx/console.spec.ts
import { normalizeLog } from '../../src/service/api/plugin/log'
const filename = 'foo.vue'
describe('console', () => {
test('console.log format', () => {
expect(
normalizeLog('log', 'at ' + filename + ':1', ['a', 'b', { a: 1 }])
).toBe(
`a---COMMA---b---COMMA------BEGIN:JSON---{"a":1}---END:JSON--- at foo.vue:1`
)
})
})