import { describe, expect, it } from 'vitest'; import { toCamelCase, toSnakeCase } from './util'; describe('toCamelCase', () => { it('중첩 객체와 배열의 키를 모두 변환한다', () => { expect(toCamelCase({ user_id: 1, nested: [{ created_at: 'x' }] })).toEqual({ userId: 1, nested: [{ createdAt: 'x' }], }); }); it('원시값은 그대로 둔다', () => { expect(toCamelCase('str')).toBe('str'); }); }); describe('toSnakeCase', () => { it('요청 바디 키를 snake_case로 바꾼다', () => { expect(toSnakeCase({ userId: 1, postBody: 'x' })).toEqual({ user_id: 1, post_body: 'x', }); }); });