How to use the isomorphic-fetch.__getRequestedUrl function in isomorphic-fetch

To help you get started, we’ve selected a few isomorphic-fetch examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github eugene-manuilov / redux-wordpress / __tests__ / fetchEndpoint.js View on Github external
const dispatch = action => {
		if (called++) {
			expect(require('isomorphic-fetch').__getRequestedUrl(mockData)).toBe(`http://wordpress.test/wp-json/wp/v2/${endpoint}/${endpoint2}?context=view`);

			expect(action.type).toBe(`@@wp/${name}/fetched/${endpoint}/${endpoint2}`);
			expect(action.total).toBeUndefined();
			expect(action.totalPages).toBeUndefined();
			expect(action.results).toBeUndefined();
			expect(action.ok).toBeFalsy();
			expect(action.message).toBe(statusText);
		} else {
			expect(action.type).toBe(`@@wp/${name}/fetching/${endpoint}/${endpoint2}`);
		}

		expect(action.params).toEqual(params);
	};
github eugene-manuilov / redux-wordpress / __tests__ / fetchById.js View on Github external
const dispatch = action => {
		if (called++) {
			expect(require('isomorphic-fetch').__getRequestedUrl(mockData)).toBe(`http://wordpress.test/wp-json/wp/v2/${endpoint}/${item.id}?context=view`);

			expect(action.type).toBe(`@@wp/${name}/fetched-by-id/${endpoint}`);
			expect(action.ok).toBeTruthy();
			expect(action.result).toEqual(item);
		} else {
			expect(action.type).toBe(`@@wp/${name}/fetching-by-id/${endpoint}`);
		}

		expect(action.params).toEqual(params);
		expect(action.id).toBe(item.id);
	};
github eugene-manuilov / redux-wordpress / __tests__ / fetchEndpointById.js View on Github external
const dispatch = action => {
		if (called++) {
			expect(require('isomorphic-fetch').__getRequestedUrl(mockData)).toBe(`http://wordpress.test/wp-json/wp/v2/${endpoint}/${id}/${endpoint2}?context=view`);

			expect(action.type).toBe(`@@wp/${name}/fetched-by-id/${endpoint}/${endpoint2}`);
			expect(action.result).toBeUndefined();
			expect(action.ok).toBeFalsy();
			expect(action.message).toBe(statusText);
		} else {
			expect(action.type).toBe(`@@wp/${name}/fetching-by-id/${endpoint}/${endpoint2}`);
		}

		expect(action.params).toEqual(params);
		expect(action.id).toBe(id);
	};
github eugene-manuilov / redux-wordpress / __tests__ / fetch.js View on Github external
const dispatch = action => {
		if (called++) {
			expect(require('isomorphic-fetch').__getRequestedUrl(mockData)).toBe(`http://wordpress.test/wp-json/wp/v2/${endpoint}?context=view`);

			expect(action.type).toBe(`@@wp/${name}/fetched/${endpoint}`);
			expect(action.total).toBeUndefined();
			expect(action.totalPages).toBeUndefined();
			expect(action.results).toBeUndefined();
			expect(action.ok).toBeFalsy();
			expect(action.message).toBe(statusText);
		} else {
			expect(action.type).toBe(`@@wp/${name}/fetching/${endpoint}`);
		}

		expect(action.params).toEqual(params);
	};