UNPKG

abso

Version:

48 lines (42 loc) 1.15 kB
/** * @license Copyright (c) 2015-present, Absolvent.pl * For licensing, see LICENSE */ 'use strict'; import createApiRequestUri from '../createApiRequestUri'; import test from 'lookly-preset-ava/test'; test('constructs api request uri with query params for method not provided', t => { t.is(createApiRequestUri('http://example.com', 'test', { foo: [ 1, 2, ], }), 'http://example.com/test?foo%5B%5D=1&foo%5B%5D=2'); }); test('constructs api request uri with query params for \'GET\'', t => { t.is(createApiRequestUri('http://example.com', 'test', { foo: [ 1, 2, ], }, 'GET'), 'http://example.com/test?foo%5B%5D=1&foo%5B%5D=2'); }); test('constructs api request uri with query params for \'HEAD\'', t => { t.is(createApiRequestUri('http://example.com', 'test', { foo: [ 1, 2, ], }, 'HEAD'), 'http://example.com/test?foo%5B%5D=1&foo%5B%5D=2'); }); test('constructs api request without query params for other method', t => { t.is(createApiRequestUri('http://example.com', 'test', { foo: [ 1, 2, ], }, 'POST'), 'http://example.com/test'); });