mirror of
https://github.com/discordeno/discordeno.git
synced 2026-05-31 16:00:07 +00:00
* test(utils): add urltobase64 test * test(utils): add token test * test(utils): fix missing import buffer * test(utils): add casting test * test(utils): add casting test * test(utils): fix use correct function
48 lines
1.2 KiB
TypeScript
48 lines
1.2 KiB
TypeScript
import { expect } from 'chai'
|
|
import { describe, it } from 'mocha'
|
|
import { camelize, snakeToCamelCase } from '../src/casing.js'
|
|
|
|
describe('casting.ts', () => {
|
|
describe('camelize function', () => {
|
|
it('will convert snake case object to camel case object', () => {
|
|
expect(
|
|
camelize({
|
|
test_ax_by_cz: 'dummy_dx_ey_fz',
|
|
testgxhyiz: 'dummyjxkylz',
|
|
32: 'adw_dw',
|
|
}),
|
|
).to.deep.equal({
|
|
testAxByCz: 'dummy_dx_ey_fz',
|
|
testgxhyiz: 'dummyjxkylz',
|
|
32: 'adw_dw',
|
|
})
|
|
})
|
|
|
|
it('will convert array of snake case object to camel case object', () => {
|
|
expect(
|
|
camelize([
|
|
{
|
|
test_ax_by_cz: 'dummy_dx_ey_fz',
|
|
},
|
|
{
|
|
test_gx_hy_iz: 'dummy_jx_ky_lz',
|
|
},
|
|
]),
|
|
).to.deep.equal([
|
|
{
|
|
testAxByCz: 'dummy_dx_ey_fz',
|
|
},
|
|
{
|
|
testGxHyIz: 'dummy_jx_ky_lz',
|
|
},
|
|
])
|
|
})
|
|
|
|
describe('snakeToCamelCase function', () => {
|
|
it('will convert string snake case to camel case', () => {
|
|
expect(snakeToCamelCase('sd_sd')).to.equal('sdSd')
|
|
})
|
|
})
|
|
})
|
|
})
|