playwright-fluent
Version:
Fluent API around playwright
33 lines (32 loc) • 1.29 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const SUT = tslib_1.__importStar(require("../index"));
describe('stringifyRequest', () => {
test('should parse query string', async () => {
// Given
const url = 'https://reactstrap.github.io/components/form/?email=foo.bar%40baz.com&password=don%27t+tel+%21%21&select=3&selectMulti=1&selectMulti=3&selectMulti=5&text=bla+bla+bla&file=&radio1=on';
// When
const result = SUT.toQueryString(url);
// Then
expect(result.email).toBe('foo.bar@baz.com');
expect(result.password).toBe("don't tel !!");
expect(result.selectMulti).toMatchObject(['1', '3', '5']);
});
test('should parse empty query string', async () => {
// Given
const url = 'https://reactstrap.github.io/components/form/?';
// When
const result = SUT.toQueryString(url);
// Then
expect(result).toMatchObject({});
});
test('should parse no query string', async () => {
// Given
const url = 'https://reactstrap.github.io/components/form/';
// When
const result = SUT.toQueryString(url);
// Then
expect(result).toMatchObject({});
});
});
;