Skip to content

Commit 6a8f2dd

Browse files
committed
Update tests
1 parent cd2dc4d commit 6a8f2dd

File tree

4 files changed

+13
-13
lines changed

4 files changed

+13
-13
lines changed

src/api/fetchContent.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {
66
import type {ApiKey} from '@croct/sdk/apiKey';
77
import type {Logger} from '@croct/sdk/logging';
88
import {formatCause} from '@croct/sdk/error';
9-
import {getSlotContent} from '@croct/content';
9+
import {loadSlotContent} from '@croct/content';
1010
import {JsonObject, JsonValue} from '../sdk/json';
1111
import {FetchResponse} from '../plug';
1212
import {SlotContent, VersionedSlotId} from '../slot';
@@ -65,7 +65,7 @@ export function fetchContent<I extends VersionedSlotId, C extends JsonObject>(
6565
return {content: fallback};
6666
}
6767

68-
const staticContent = await getSlotContent(id, (fetchOptions as DynamicContentOptions).preferredLocale);
68+
const staticContent = await loadSlotContent(id, (fetchOptions as DynamicContentOptions).preferredLocale);
6969

7070
if (staticContent === null) {
7171
throw error;

src/plug.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import {
1515
} from '@croct/sdk/trackingEvents';
1616
import {VERSION} from '@croct/sdk';
1717
import {FetchOptions as BaseFetchOptions} from '@croct/sdk/facade/contentFetcherFacade';
18-
import {getSlotContent} from '@croct/content';
18+
import {loadSlotContent} from '@croct/content';
1919
import {Plugin, PluginArguments, PluginFactory} from './plugin';
2020
import {CDN_URL} from './constants';
2121
import {factory as playgroundPluginFactory} from './playground';
@@ -376,7 +376,7 @@ export class GlobalPlug implements Plug {
376376
.catch(async error => {
377377
logger.error(`Failed to fetch content for slot "${id}@${version}": ${formatCause(error)}`);
378378

379-
const fallback = await getSlotContent(slotId, options.preferredLocale);
379+
const fallback = await loadSlotContent(slotId, options.preferredLocale);
380380

381381
if (fallback === null) {
382382
throw error;

test/api/fetchContent.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import {ContentFetcher} from '@croct/sdk/contentFetcher';
22
import {Logger} from '@croct/sdk/logging';
33
import {JsonObject} from '@croct/json';
4-
import {getSlotContent} from '@croct/content';
4+
import {loadSlotContent} from '@croct/content';
55
import {FetchResponse} from '../../src/plug';
66
import {SlotContent} from '../../src/slot';
77
import {fetchContent, FetchOptions} from '../../src/api';
@@ -27,7 +27,7 @@ jest.mock(
2727
'@croct/content',
2828
() => ({
2929
__esModule: true,
30-
getSlotContent: jest.fn().mockResolvedValue(null),
30+
loadSlotContent: jest.fn().mockResolvedValue(null),
3131
}),
3232
);
3333

@@ -244,7 +244,7 @@ describe('fetchContent', () => {
244244
title: 'Hello World',
245245
};
246246

247-
jest.mocked(getSlotContent).mockResolvedValue(content);
247+
jest.mocked(loadSlotContent).mockResolvedValue(content);
248248

249249
await expect(fetchContent('test', options)).resolves.toEqual({
250250
content: content,
@@ -274,7 +274,7 @@ describe('fetchContent', () => {
274274
title: '¡Hola, Mundo!',
275275
};
276276

277-
jest.mocked(getSlotContent).mockResolvedValue(content);
277+
jest.mocked(loadSlotContent).mockResolvedValue(content);
278278

279279
await expect(fetchContent('test', options)).resolves.toEqual({
280280
content: content,
@@ -302,7 +302,7 @@ describe('fetchContent', () => {
302302

303303
jest.mocked(mockFetch).mockRejectedValue(error);
304304

305-
jest.mocked(getSlotContent).mockResolvedValue(null);
305+
jest.mocked(loadSlotContent).mockResolvedValue(null);
306306

307307
await expect(fetchContent('test', options)).rejects.toBe(error);
308308

test/plug.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import {SdkFacade, Configuration as SdkFacadeConfiguration} from '@croct/sdk/facade/sdkFacade';
22
import {FetchOptions} from '@croct/sdk/facade/contentFetcherFacade';
33
import {JsonObject} from '@croct/json';
4-
import {getSlotContent} from '@croct/content';
4+
import {loadSlotContent} from '@croct/content';
55
import {Logger} from '../src/sdk';
66
import {Plugin, PluginFactory} from '../src/plugin';
77
import {GlobalPlug} from '../src/plug';
@@ -19,7 +19,7 @@ jest.mock(
1919
'@croct/content',
2020
() => ({
2121
__esModule: true,
22-
getSlotContent: jest.fn().mockResolvedValue(null),
22+
loadSlotContent: jest.fn().mockResolvedValue(null),
2323
}),
2424
);
2525

@@ -956,7 +956,7 @@ describe('The Croct plug', () => {
956956
title: 'Hello World',
957957
};
958958

959-
jest.mocked(getSlotContent).mockResolvedValue(content);
959+
jest.mocked(loadSlotContent).mockResolvedValue(content);
960960

961961
await expect(croct.fetch(slotId)).resolves.toEqual({
962962
content: content,
@@ -1000,7 +1000,7 @@ describe('The Croct plug', () => {
10001000
title: '¡Hola, Mundo!',
10011001
};
10021002

1003-
jest.mocked(getSlotContent).mockResolvedValue(content);
1003+
jest.mocked(loadSlotContent).mockResolvedValue(content);
10041004

10051005
await expect(croct.fetch(slotId, options)).resolves.toEqual({
10061006
content: content,

0 commit comments

Comments
 (0)