@elastic/ems-client 8.4.1 → 8.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,6 +7,7 @@
7
7
 
8
8
  import { getEMSClient } from './ems_client_util';
9
9
  import { FileLayer } from '../src/file_layer';
10
+ import { LATEST_API_URL_PATH } from '../src/ems_client';
10
11
 
11
12
  it('should get api manifests', async () => {
12
13
  const { emsClient, getManifestMock } = getEMSClient({
@@ -466,3 +467,35 @@ it('should retrieve vectorstylesheet with all sources inlined) (proxy)', async (
466
467
  );
467
468
  expect(styleSheet!.sources!.openmaptiles!.type).toBe('vector');
468
469
  });
470
+
471
+ it('should use LATEST_API_URL_PATH for date based versions (serverless)', async () => {
472
+ const version = '2023-01-01';
473
+ const { emsClient } = getEMSClient({
474
+ appVersion: version,
475
+ emsVersion: version,
476
+ });
477
+
478
+ const { services } = await emsClient.getMainManifest();
479
+
480
+ expect(services.length).toBeGreaterThan(0);
481
+
482
+ ['tms', 'file'].map((type) => {
483
+ const service = services.find((s) => s.type === type);
484
+ const manifestUrl = service?.manifest;
485
+
486
+ expect(manifestUrl).toBeDefined();
487
+ expect(manifestUrl?.match(LATEST_API_URL_PATH)).toBeTruthy();
488
+ });
489
+ });
490
+
491
+ it('should fail for non SemVer or Date based versions (serverless)', async () => {
492
+ const version = 'foo';
493
+ const t = () => {
494
+ getEMSClient({
495
+ appVersion: version,
496
+ emsVersion: version,
497
+ });
498
+ };
499
+
500
+ expect(t).toThrow(Error);
501
+ });