$88 GRAYBYTE WORDPRESS FILE MANAGER $68

SERVER : premium201.web-hosting.com #1 SMP Wed Mar 26 12:08:09 UTC 2025
SERVER IP : 172.67.217.254 | ADMIN IP 216.73.216.180
OPTIONS : CRL = ON | WGT = ON | SDO = OFF | PKEX = OFF
DEACTIVATED : mail

/home/bravrvjk/dantho.rw/wp-content/plugins/extendify/src/Shared/lib/__tests__/

HOME
Current File : /home/bravrvjk/dantho.rw/wp-content/plugins/extendify/src/Shared/lib/__tests__//utils.test.js
import { isObject, deepMerge, sleep } from '@shared/lib/utils';

describe('isObject', () => {
	it('returns true for plain objects', () => {
		expect(isObject({})).toBe(true);
		expect(isObject({ a: 1 })).toBe(true);
	});

	it('returns false for arrays', () => {
		expect(isObject([])).toBe(false);
	});

	it('returns false for null', () => {
		expect(isObject(null)).toBe(false);
	});

	it('returns false for other types', () => {
		expect(isObject(42)).toBe(false);
		expect(isObject('string')).toBe(false);
		expect(isObject(undefined)).toBe(false);
	});
});

describe('deepMerge', () => {
	it('merges two flat objects', () => {
		const result = deepMerge({ a: 1 }, { b: 2 });
		expect(result).toEqual({ a: 1, b: 2 });
	});

	it('merges deeply nested objects', () => {
		const result = deepMerge({ a: { x: 1 }, b: 2 }, { a: { y: 3 }, c: 4 });
		expect(result).toEqual({ a: { x: 1, y: 3 }, b: 2, c: 4 });
	});

	it('overwrites non-object values', () => {
		const result = deepMerge({ a: 1 }, { a: 2 });
		expect(result).toEqual({ a: 2 });
	});

	it('returns null if any input is not an object', () => {
		expect(deepMerge(null, { a: 1 })).toBeNull();
		expect(deepMerge({ a: 1 }, 123)).toBeNull();
	});
});

describe('sleep', () => {
	it('resolves after given time', async () => {
		const start = Date.now();
		await sleep(50);
		const duration = Date.now() - start;
		expect(duration).toBeGreaterThanOrEqual(49);
	});
});


Current_dir [ WRITEABLE ] Document_root [ NOT WRITEABLE ]


[ Back ]
NAME
SIZE
LAST TOUCH
USER
CAN-I?
FUNCTIONS
..
--
6 Nov 2025 10.43 AM
bravrvjk / bravrvjk
0755
dom.test.js
0.489 KB
14 Apr 2025 8.31 PM
bravrvjk / bravrvjk
0644
parsing.test.js
0.797 KB
14 Apr 2025 8.31 PM
bravrvjk / bravrvjk
0644
utils.test.js
1.391 KB
14 Apr 2025 8.31 PM
bravrvjk / bravrvjk
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2025 CONTACT ME
Static GIF