Software: Apache. PHP/8.1.30 uname -a: Linux server1.tuhinhossain.com 5.15.0-163-generic #173-Ubuntu SMP Tue Oct 14 17:51:00 UTC uid=1002(picotech) gid=1003(picotech) groups=1003(picotech),0(root) Safe-mode: OFF (not secure) /home/picotech/domains/inventory.picotech.app/public_html/node_modules/bootstrap-vue/src/utils/ drwxr-xr-x | |
| Viewing file: Select action/file-type: import { stringifyObjectValues } from './stringify-object-values'
describe('stringifyObjectValues()', () => {
it('handles `null` and `undefined`', async () => {
expect(stringifyObjectValues(null)).toBe('')
expect(stringifyObjectValues(undefined)).toBe('')
expect(stringifyObjectValues()).toBe('')
})
it('returns strings as-is', async () => {
expect(stringifyObjectValues('foo')).toBe('foo')
expect(stringifyObjectValues('123')).toBe('123')
expect(stringifyObjectValues(' bar ')).toBe(' bar ')
})
it('converts numbers to string', async () => {
expect(stringifyObjectValues(0)).toBe('0')
expect(stringifyObjectValues(1)).toBe('1')
expect(stringifyObjectValues(-1)).toBe('-1')
})
it('converts dates to native string format', async () => {
const date1 = new Date(2020, 1, 1)
const date2 = new Date(2030, 1, 1)
const date3 = new Date(1970, 1, 1)
expect(stringifyObjectValues(date1)).toBe(date1.toString())
expect(stringifyObjectValues(date2)).toBe(date2.toString())
expect(stringifyObjectValues(date3)).toBe(date3.toString())
})
it('converts array values to a string', async () => {
expect(stringifyObjectValues([])).toBe('')
expect(stringifyObjectValues([1, 'foo'])).toBe('1 foo')
expect(stringifyObjectValues([undefined, null])).toBe('')
})
it('converts object values to a string', async () => {
expect(stringifyObjectValues({})).toBe('')
expect(stringifyObjectValues({ a: 1, b: 'foo' })).toBe('1 foo')
expect(stringifyObjectValues({ a: null, b: undefined })).toBe('')
expect(stringifyObjectValues({ a: [undefined, null, { b: 1 }] })).toBe('1')
expect(
stringifyObjectValues({ b: 3, c: { z: 'zzz', d: null, e: 2 }, d: [10, 12, 11], a: 'one' })
).toBe('one 3 2 zzz 10 12 11')
})
})
|
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0031 ]-- |