PHP Classes

File: tests/unit/utils/url-generator.test.ts

Recommend this page to a friend!
  Classes of Maniruzzaman Akash   Maniruzzaman WordPress Frontend Editor   tests/unit/utils/url-generator.test.ts   Download  
File: tests/unit/utils/url-generator.test.ts
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: Maniruzzaman WordPress Frontend Editor
WordPress plugin for visual front-end development
Author: By
Last change:
Date: 8 months ago
Size: 1,010 bytes
 

Contents

Class file image Download
/** * Internal dependencies. */ import { buildQueryByParameters } from "../../../src/utils/url-generator"; describe('buildQueryByParameters', () => { it('should build a query string from the given parameters', () => { const filter = { status: 'active', mission: 'CRS-1', type: 'Dragon 1.1', }; const baseUrl = 'https://example.com'; const expectedResult = 'https://example.com?status=active&mission=CRS-1&type=Dragon 1.1'; const result = buildQueryByParameters(filter, baseUrl); expect(result).toBe(expectedResult); }); it('should only include parameters with truthy values', () => { const filter = { a: '1', b: false, c: '', }; const baseUrl = 'https://example.com'; const expectedResult = 'https://example.com?a=1'; const result = buildQueryByParameters(filter, baseUrl); expect(result).toBe(expectedResult); }); });