$34 GRAYBYTE WORDPRESS FILE MANAGER $25

SERVER : premium201.web-hosting.com #1 SMP Wed Mar 26 12:08:09 UTC 2025
SERVER IP : 104.21.43.35 | 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/api/__tests__/

HOME
Current File : /home/bravrvjk/dantho.rw/wp-content/plugins/extendify/src/Shared/api/__tests__//wp.test.js
import apiFetch from '@wordpress/api-fetch';
import * as wpAPI from '@shared/api/wp';

jest.mock('@wordpress/api-fetch');

describe('WordPress Plugin API helpers', () => {
	afterEach(() => {
		jest.clearAllMocks();
	});

	it('getPlugin calls correct endpoint', async () => {
		apiFetch.mockResolvedValueOnce([{ name: 'test-plugin' }]);

		const result = await wpAPI.getPlugin('test-plugin');
		expect(apiFetch).toHaveBeenCalledWith({
			path: '/wp/v2/plugins?search=test-plugin',
		});
		expect(result).toEqual({ name: 'test-plugin' });
	});

	it('installPlugin calls correct POST endpoint', async () => {
		apiFetch.mockResolvedValueOnce({ success: true });

		const result = await wpAPI.installPlugin('my-plugin');
		expect(apiFetch).toHaveBeenCalledWith({
			path: '/wp/v2/plugins',
			method: 'POST',
			data: { slug: 'my-plugin' },
		});
		expect(result).toEqual({ success: true });
	});

	it('activatePlugin calls correct POST endpoint', async () => {
		apiFetch.mockResolvedValueOnce([{ name: 'plugin-x' }]);
		apiFetch.mockResolvedValueOnce({ activated: true });

		const result = await wpAPI.activatePlugin('plugin-x');
		expect(apiFetch).toHaveBeenCalledTimes(2);
		expect(result).toEqual({ activated: true });
	});
});


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
wp.test.js
1.201 KB
14 Apr 2025 8.31 PM
bravrvjk / bravrvjk
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2025 CONTACT ME
Static GIF