mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 03:19:46 +00:00
test(utils.ts): isObjectEmpty function
This commit is contained in:
parent
c17db58448
commit
0c9e3e2b47
1 changed files with 10 additions and 2 deletions
|
|
@ -1,5 +1,5 @@
|
|||
import { isNumberFrom1To100 } from '@/utils.ts';
|
||||
import { assertEquals } from 'https://deno.land/std@0.132.0/testing/asserts.ts';
|
||||
import { isNumberFrom1To100, isObjectEmpty } from '@/utils.ts';
|
||||
import { assertEquals } from '@std/assert';
|
||||
|
||||
Deno.test('Value is any number from 1 to 100', () => {
|
||||
assertEquals(isNumberFrom1To100('latvia'), false);
|
||||
|
|
@ -19,3 +19,11 @@ Deno.test('Value is any number from 1 to 100', () => {
|
|||
|
||||
assertEquals(isNumberFrom1To100('1e1'), true);
|
||||
});
|
||||
|
||||
Deno.test('Object is empty', () => {
|
||||
assertEquals(isObjectEmpty([1]), false);
|
||||
assertEquals(isObjectEmpty({ 'yolo': 'no yolo' }), false);
|
||||
|
||||
assertEquals(isObjectEmpty([]), true);
|
||||
assertEquals(isObjectEmpty({}), true);
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue