Skip to content

Commit

Permalink
chore: revert unrelated change
Browse files Browse the repository at this point in the history
  • Loading branch information
EmmanuelRoux committed Jan 3, 2025
1 parent 2d9b301 commit 2b1fe2a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,6 @@ export class MatomoInitializerService {

if (isAutoConfigurationMode(this.config)) {
this.injectMatomoScript(this.config);
} else {
// Mode is manual, immediately resolve deferred config
this.deferredConfig.markReady(this.config);
}
}, ALREADY_INITIALIZED_ERROR);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,8 @@ describe('MatomoFormAnalyticsInitializer', () => {

it('should throw when trying to inject default script without tracker configuration', async () => {
// Given
let handleError: (error: unknown) => void;
const caughtError = new Promise(resolve => (handleError = resolve));
let resolveCaughtError: (error: unknown) => void;
const caughtError = new Promise(resolve => (resolveCaughtError = resolve));

await setUp(
{
Expand All @@ -150,18 +150,22 @@ describe('MatomoFormAnalyticsInitializer', () => {
[
{
provide: ErrorHandler,
useFactory: (): ErrorHandler => ({ handleError }),
useValue: {
handleError: error => resolveCaughtError(error),
} satisfies ErrorHandler,
},
],
);

// Then
await expectAsync(caughtError).toBeResolvedTo(
new Error(
'Cannot resolve default matomo FormAnalytics plugin script url. ' +
'Please explicitly provide `loadScript` configuration property instead of `true`',
),
);
// TODO change to expect error when #102 is fixed
await expectAsync(caughtError).toBePending();
// await expectAsync(caughtError).toBeResolvedTo(
// new Error(
// 'Cannot resolve default matomo FormAnalytics plugin script url. ' +
// 'Please explicitly provide `loadScript` configuration property instead of `true`',
// ),
// );
expectNoInjectedScript();
});

Expand Down

0 comments on commit 2b1fe2a

Please sign in to comment.