Skip to content

Commit bd6f253

Browse files
author
FrancescoMauto
committed
[DSC-1786] fix: revert of klaro specs
1 parent cfdaeb3 commit bd6f253

1 file changed

Lines changed: 0 additions & 156 deletions

File tree

src/app/shared/cookies/browser-klaro.service.spec.ts

Lines changed: 0 additions & 156 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@ import { RestResponse } from '../../core/cache/response.models';
1111
import { ConfigurationDataService } from '../../core/data/configuration-data.service';
1212
import { EPersonDataService } from '../../core/eperson/eperson-data.service';
1313
import { EPerson } from '../../core/eperson/models/eperson.model';
14-
import {
15-
CAPTCHA_FEEDBACK_NAME,
16-
CAPTCHA_REGISTRATION_NAME,
17-
} from '../../core/google-recaptcha/google-recaptcha.service';
1814
import { CookieService } from '../../core/services/cookie.service';
1915
import { NativeWindowService } from '../../core/services/window.service';
2016
import { ConfigurationProperty } from '../../core/shared/configuration-property.model';
@@ -28,7 +24,6 @@ import {
2824
import {
2925
BrowserKlaroService,
3026
COOKIE_MDFIELD,
31-
LAZY_KLARO,
3227
} from './browser-klaro.service';
3328
import { ANONYMOUS_STORAGE_NAME_KLARO } from './klaro-configuration';
3429

@@ -111,10 +106,6 @@ describe('BrowserKlaroService', () => {
111106
provide: ConfigurationDataService,
112107
useValue: configurationDataService,
113108
},
114-
{
115-
provide: LAZY_KLARO,
116-
useValue: Promise.resolve({ setup: () => {/* noop */} }),
117-
},
118109
],
119110
});
120111
service = TestBed.inject(BrowserKlaroService);
@@ -137,12 +128,6 @@ describe('BrowserKlaroService', () => {
137128
}, {
138129
name: googleAnalytics,
139130
purposes: [purpose],
140-
}, {
141-
name: CAPTCHA_REGISTRATION_NAME,
142-
purposes: [purpose],
143-
}, {
144-
name: CAPTCHA_FEEDBACK_NAME,
145-
purposes: [purpose],
146131
}],
147132

148133
};
@@ -481,146 +466,5 @@ describe('BrowserKlaroService', () => {
481466
service.initialize();
482467
expect(service.klaroConfig.services).not.toContain(jasmine.objectContaining({ name: googleAnalytics }));
483468
});
484-
it('should show both recaptcha services when both verifications are enabled', () => {
485-
configurationDataService.findByPropertyName = jasmine.createSpy('configurationDataService').and.returnValue(
486-
createSuccessfulRemoteDataObject$({
487-
... new ConfigurationProperty(),
488-
name: trackingIdTestValue,
489-
values: ['true'],
490-
}),
491-
);
492-
service.initialize();
493-
expect(service.klaroConfig.services).toContain(jasmine.objectContaining({ name: CAPTCHA_REGISTRATION_NAME }));
494-
expect(service.klaroConfig.services).toContain(jasmine.objectContaining({ name: CAPTCHA_FEEDBACK_NAME }));
495-
});
496-
it('should hide registration recaptcha service when registration verification is disabled', () => {
497-
configurationDataService.findByPropertyName =
498-
jasmine.createSpy('configurationDataService')
499-
.withArgs(GOOGLE_ANALYTICS_KEY)
500-
.and
501-
.returnValue(
502-
createSuccessfulRemoteDataObject$({
503-
... new ConfigurationProperty(),
504-
name: trackingIdProp,
505-
values: [googleAnalytics],
506-
}),
507-
)
508-
.withArgs(REGISTRATION_VERIFICATION_ENABLED_KEY)
509-
.and
510-
.returnValue(
511-
createSuccessfulRemoteDataObject$({
512-
... new ConfigurationProperty(),
513-
name: trackingIdTestValue,
514-
values: ['false'],
515-
}),
516-
)
517-
.withArgs(FEEDBACK_VERIFICATION_ENABLED_KEY)
518-
.and
519-
.returnValue(
520-
createSuccessfulRemoteDataObject$({
521-
... new ConfigurationProperty(),
522-
name: trackingIdTestValue,
523-
values: ['true'],
524-
}),
525-
)
526-
.withArgs(MATOMO_ENABLED)
527-
.and
528-
.returnValue(
529-
createSuccessfulRemoteDataObject$({
530-
... new ConfigurationProperty(),
531-
name: matomoTrackingId,
532-
values: ['true'],
533-
}),
534-
);
535-
service.initialize();
536-
expect(service.klaroConfig.services).not.toContain(jasmine.objectContaining({ name: CAPTCHA_REGISTRATION_NAME }));
537-
expect(service.klaroConfig.services).toContain(jasmine.objectContaining({ name: CAPTCHA_FEEDBACK_NAME }));
538-
});
539-
it('should hide feedback recaptcha service when feedback verification is disabled', () => {
540-
configurationDataService.findByPropertyName =
541-
jasmine.createSpy('configurationDataService')
542-
.withArgs(GOOGLE_ANALYTICS_KEY)
543-
.and
544-
.returnValue(
545-
createSuccessfulRemoteDataObject$({
546-
... new ConfigurationProperty(),
547-
name: trackingIdProp,
548-
values: [googleAnalytics],
549-
}),
550-
)
551-
.withArgs(REGISTRATION_VERIFICATION_ENABLED_KEY)
552-
.and
553-
.returnValue(
554-
createSuccessfulRemoteDataObject$({
555-
... new ConfigurationProperty(),
556-
name: trackingIdTestValue,
557-
values: ['true'],
558-
}),
559-
)
560-
.withArgs(FEEDBACK_VERIFICATION_ENABLED_KEY)
561-
.and
562-
.returnValue(
563-
createSuccessfulRemoteDataObject$({
564-
... new ConfigurationProperty(),
565-
name: trackingIdTestValue,
566-
values: ['false'],
567-
}),
568-
)
569-
.withArgs(MATOMO_ENABLED)
570-
.and
571-
.returnValue(
572-
createSuccessfulRemoteDataObject$({
573-
... new ConfigurationProperty(),
574-
name: matomoTrackingId,
575-
values: ['true'],
576-
}),
577-
);
578-
service.initialize();
579-
expect(service.klaroConfig.services).toContain(jasmine.objectContaining({ name: CAPTCHA_REGISTRATION_NAME }));
580-
expect(service.klaroConfig.services).not.toContain(jasmine.objectContaining({ name: CAPTCHA_FEEDBACK_NAME }));
581-
});
582-
it('should hide both recaptcha services when both verifications are disabled', () => {
583-
configurationDataService.findByPropertyName =
584-
jasmine.createSpy('configurationDataService')
585-
.withArgs(GOOGLE_ANALYTICS_KEY)
586-
.and
587-
.returnValue(
588-
createSuccessfulRemoteDataObject$({
589-
... new ConfigurationProperty(),
590-
name: trackingIdProp,
591-
values: [googleAnalytics],
592-
}),
593-
)
594-
.withArgs(REGISTRATION_VERIFICATION_ENABLED_KEY)
595-
.and
596-
.returnValue(
597-
createSuccessfulRemoteDataObject$({
598-
... new ConfigurationProperty(),
599-
name: trackingIdTestValue,
600-
values: ['false'],
601-
}),
602-
)
603-
.withArgs(FEEDBACK_VERIFICATION_ENABLED_KEY)
604-
.and
605-
.returnValue(
606-
createSuccessfulRemoteDataObject$({
607-
... new ConfigurationProperty(),
608-
name: trackingIdTestValue,
609-
values: ['false'],
610-
}),
611-
)
612-
.withArgs(MATOMO_ENABLED)
613-
.and
614-
.returnValue(
615-
createSuccessfulRemoteDataObject$({
616-
... new ConfigurationProperty(),
617-
name: matomoTrackingId,
618-
values: ['true'],
619-
}),
620-
);
621-
service.initialize();
622-
expect(service.klaroConfig.services).not.toContain(jasmine.objectContaining({ name: CAPTCHA_REGISTRATION_NAME }));
623-
expect(service.klaroConfig.services).not.toContain(jasmine.objectContaining({ name: CAPTCHA_FEEDBACK_NAME }));
624-
});
625469
});
626470
});

0 commit comments

Comments
 (0)