Skip to content

Commit

Permalink
fix: correctly resolve deferred configuration when using manual ini…
Browse files Browse the repository at this point in the history
…tialization mode

fixes #102
  • Loading branch information
EmmanuelRoux committed Jan 3, 2025
1 parent 0e4a956 commit da82506
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ 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 @@ -158,14 +158,12 @@ describe('MatomoFormAnalyticsInitializer', () => {
);

// Then
// 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`',
// ),
// );
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 da82506

Please sign in to comment.