import { HttpRequest } from '@angular/common/http'; import { isStoreCatalogRequest } from './app.config'; describe('isStoreCatalogRequest', () => { it.each([ 'http://localhost:8000/api/tenants/demo/catalog', 'http://localhost:8000/api/tenants/demo/catalog?currency=ARS', 'http://localhost:8000/api/tenants/demo/catalog/featured-groups/7/items?page=2', 'http://localhost:8000/api/tenants/demo/catalog-items?q=remera&page=1', 'http://localhost:8000/api/tenants/demo/catalog-items/42?variant_id=3', ])('includes GET %s in the hydration transfer cache', (url) => { expect(isStoreCatalogRequest(new HttpRequest('GET', url))).toBe(true); }); it.each([ ['POST', 'http://localhost:8000/api/tenants/demo/catalog-items'], ['GET', 'http://localhost:8000/api/tenants/demo/productos'], ['GET', 'http://localhost:8000/api/tenants/demo/categories/7'], ['GET', 'http://localhost:8000/api/tenants/demo/catalog-items/42/variant-options'], ['GET', 'http://localhost:8000/api/tenants/demo/catalogue'], ])('excludes %s %s from the hydration transfer cache', (method, url) => { const request = method === 'GET' ? new HttpRequest('GET', url) : new HttpRequest('POST', url, null); expect(isStoreCatalogRequest(request)).toBe(false); }); });