mirror of
https://github.com/bitwarden/browser
synced 2025-12-20 18:23:31 +00:00
update tests and cleanup
This commit is contained in:
@@ -463,6 +463,11 @@ const safeProviders: SafeProvider[] = [
|
||||
useClass: CipherFileUploadService,
|
||||
deps: [ApiServiceAbstraction, FileUploadServiceAbstraction],
|
||||
}),
|
||||
safeProvider({
|
||||
provide: DomainSettingsService,
|
||||
useClass: DefaultDomainSettingsService,
|
||||
deps: [StateProvider, ConfigService],
|
||||
}),
|
||||
safeProvider({
|
||||
provide: CipherServiceAbstraction,
|
||||
useFactory: (
|
||||
@@ -1243,11 +1248,6 @@ const safeProviders: SafeProvider[] = [
|
||||
useClass: BadgeSettingsService,
|
||||
deps: [StateProvider],
|
||||
}),
|
||||
safeProvider({
|
||||
provide: DomainSettingsService,
|
||||
useClass: DefaultDomainSettingsService,
|
||||
deps: [StateProvider, ConfigService],
|
||||
}),
|
||||
safeProvider({
|
||||
provide: BiometricStateService,
|
||||
useClass: DefaultBiometricStateService,
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
import { MockProxy, mock } from "jest-mock-extended";
|
||||
import { firstValueFrom, of } from "rxjs";
|
||||
|
||||
import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service";
|
||||
|
||||
import { FakeStateProvider, FakeAccountService, mockAccountServiceWith } from "../../../spec";
|
||||
import { Utils } from "../../platform/misc/utils";
|
||||
import { UserId } from "../../types/guid";
|
||||
@@ -8,8 +11,10 @@ import { DefaultDomainSettingsService, DomainSettingsService } from "./domain-se
|
||||
|
||||
describe("DefaultDomainSettingsService", () => {
|
||||
let domainSettingsService: DomainSettingsService;
|
||||
const configServiceMock = mock<ConfigService>();
|
||||
const mockUserId = Utils.newGuid() as UserId;
|
||||
const accountService: FakeAccountService = mockAccountServiceWith(mockUserId);
|
||||
let mockConfigService: MockProxy<ConfigService>;
|
||||
const fakeStateProvider: FakeStateProvider = new FakeStateProvider(accountService);
|
||||
|
||||
const mockEquivalentDomains = [
|
||||
@@ -19,10 +24,12 @@ describe("DefaultDomainSettingsService", () => {
|
||||
];
|
||||
|
||||
beforeEach(() => {
|
||||
domainSettingsService = new DefaultDomainSettingsService(fakeStateProvider);
|
||||
domainSettingsService = new DefaultDomainSettingsService(fakeStateProvider, mockConfigService);
|
||||
jest.spyOn(configServiceMock, "getFeatureFlag$").mockReturnValue(of(false));
|
||||
|
||||
jest.spyOn(domainSettingsService, "getUrlEquivalentDomains");
|
||||
domainSettingsService.equivalentDomains$ = of(mockEquivalentDomains);
|
||||
domainSettingsService.blockedInteractionsUris$ = of(null);
|
||||
});
|
||||
|
||||
describe("getUrlEquivalentDomains", () => {
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
import { combineLatest, map, Observable } from "rxjs";
|
||||
|
||||
import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum";
|
||||
import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service";
|
||||
|
||||
import {
|
||||
NeverDomains,
|
||||
@@ -11,6 +10,7 @@ import {
|
||||
UriMatchStrategySetting,
|
||||
UriMatchStrategy,
|
||||
} from "../../models/domain/domain-service";
|
||||
import { ConfigService } from "../../platform/abstractions/config/config.service";
|
||||
import { Utils } from "../../platform/misc/utils";
|
||||
import {
|
||||
DOMAIN_SETTINGS_DISK,
|
||||
@@ -99,7 +99,7 @@ export class DefaultDomainSettingsService implements DomainSettingsService {
|
||||
|
||||
this.blockedInteractionsUris$ = combineLatest([
|
||||
this.blockedInteractionsUrisState.state$,
|
||||
this.configService.getFeatureFlag$(FeatureFlag.BlockBrowserInjectionsByDomain),
|
||||
this.configService?.getFeatureFlag$(FeatureFlag.BlockBrowserInjectionsByDomain),
|
||||
]).pipe(
|
||||
map(([blockedUris, blockBrowserInjectionsByDomainEnabled]) => {
|
||||
if (!blockBrowserInjectionsByDomainEnabled) {
|
||||
|
||||
Reference in New Issue
Block a user