Files
wehub-resource-sync bde7ea0d58
CI / ci (push) Has been cancelled
Deploy Docs / Deploy Docs (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 12:39:56 +08:00

37 lines
847 B
TypeScript

import { describe, expect, it } from 'vitest'
import { encodeLines } from '../src/index'
describe('encodeLines', () => {
it('yields lines without newline characters', () => {
const value = { name: 'Alice', age: 30, city: 'Paris' }
const lines = Array.from(encodeLines(value))
for (const line of lines) {
expect(line).not.toContain('\n')
}
})
it('yields zero lines for empty object', () => {
const lines = Array.from(encodeLines({}))
expect(lines.length).toBe(0)
})
it('yields lines without trailing spaces', () => {
const value = {
user: {
name: 'Alice',
tags: ['a', 'b'],
nested: {
deep: 'value',
},
},
}
const lines = Array.from(encodeLines(value))
for (const line of lines) {
expect(line).not.toMatch(/\s$/)
}
})
})