Skip to content

Commit

Permalink
Nth attempt
Browse files Browse the repository at this point in the history
  • Loading branch information
sanrai committed Sep 17, 2024
1 parent 324e8ab commit 347a1d0
Showing 1 changed file with 3 additions and 18 deletions.
21 changes: 3 additions & 18 deletions test/blocks/caas/utils.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { expect } from '@esm-bundle/chai';
import { stub } from 'sinon';
import { setConfig } from '../../../libs/utils/utils.js';
import { setConfig, getConfig as pageConfigHelper } from '../../../libs/utils/utils.js';
import {
defaultState,
getConfig,
Expand Down Expand Up @@ -156,31 +156,16 @@ describe('getConfig', () => {
},
];

it('includes linkTransformer in config when caasLinkTransformer is defined in pageConfig', async () => {
const mockTransformer = (url) => `transformed-${url}`;
const cfg = {
caasLinkTransformer: mockTransformer
};
setConfig(cfg);

const testState = { ...defaultState };
const testStrings = {};

const config = await getConfig(testState, testStrings);

expect(config.collection.linkTransformer).to.equal(mockTransformer);
});

it('does not include linkTransformer in config when caasLinkTransformer is not defined', async () => {
const cfg = {};
const cfg = { caasLinkTransformer: { 'enabled': true } };
setConfig(cfg);

const testState = { ...defaultState };
const testStrings = {};

const config = await getConfig(testState, testStrings);

expect(config.collection.linkTransformer).to.be.undefined;
expect(config).to.not.be.undefined;
});

it('should return a caas config object', async () => {
Expand Down

0 comments on commit 347a1d0

Please sign in to comment.