UNPKG

playwright-fluent

Version:
22 lines (21 loc) 938 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const tslib_1 = require("tslib"); const SUT = tslib_1.__importStar(require("../index")); describe('urlToShortPath(url)', () => { [ { url: 'http://localhost:8080', shortPath: '/' }, { url: 'http://localhost:8080?foo=bar', shortPath: '/?foo=bar' }, { url: 'http://localhost:8080/foobar?foo=bar', shortPath: '/foobar?foo=bar' }, { url: 'http://localhost:8080/api/v1/foobar?foo=bar', shortPath: '/v1/foobar?foo=bar' }, { url: 'http://localhost:8080/api/foobar?foo=bar', shortPath: '/api/foobar?foo=bar' }, ].forEach((testCase) => { test(`should extract the short path for url '${testCase.url}'`, async () => { // Given // When const result = SUT.urlToShortPath(testCase.url); // Then expect(result).toBe(testCase.shortPath); }); }); });