1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-20 10:13:31 +00:00
Files
browser/libs/common/src/admin-console/models/data/organization.data.spec.ts
Brandon Treston a949f793ed [PM-15506] Implement vNextOrganizationService (#12839)
* [PM-15506] Wire up vNextOrganizationService for libs/common and libs/angular (#12683)

* Wire up vNextOrganizationService in PolicyService

* Wire vNextOrganizationService in SyncService

* wire vNextOrganizationService for EventCollectionService

* wire vNextOrganizationService for KeyConnectorService

* wire up vNextOrganizationService for CipherAuthorizationService

* Wire up vNextOrganizationService in PolicyService

* Wire vNextOrganizationService in SyncService

* wire vNextOrganizationService for EventCollectionService

* wire vNextOrganizationService for KeyConnectorService

* wire up vNextOrganizationService for CipherAuthorizationService

* wire vNextOrganizationService for share.component

* wire vNextOrganizationService for collections.component

* wire vNextOrganizationServcie for add-account-credit-dialog

* wire vNextOrganizationService for vault-filter.service

* fix browser errors for vNextOrganizationService implementation in libs

* fix desktop errors for vNextOrganizationService implementation for libs

* fix linter errors

* fix CLI errors on vNextOrganizationServcie implementations for libs

* [PM-15506] Wire up vNextOrganizationService for web client (#12810)

PR to a feature branch, no need to review until this goes to main.

* implement vNextOrganization service for browser client (#12844)

PR to feature branch, no need for review yet.

* wire vNextOrganizationService for licence and some web router guards

* wire vNextOrganizationService in tests

* remove vNext notation for OrganizationService and related

* Merge branch 'main' into ac/pm-15506-vNextOrganizationService

* fix tsstrict error

* fix test, fix ts strict error
2025-01-22 15:20:25 -05:00

66 lines
2.2 KiB
TypeScript

import { ProductTierType } from "../../../billing/enums/product-tier-type.enum";
import { OrganizationUserStatusType, OrganizationUserType } from "../../enums";
import { ORGANIZATIONS } from "../../services/organization/organization.state";
import { OrganizationData } from "./organization.data";
describe("ORGANIZATIONS state", () => {
const sut = ORGANIZATIONS;
it("should deserialize JSON string to proper object", async () => {
const expectedResult: Record<string, OrganizationData> = {
"1": {
id: "id",
name: "name",
status: OrganizationUserStatusType.Invited,
type: OrganizationUserType.Owner,
enabled: false,
usePolicies: false,
useGroups: false,
useDirectory: false,
useEvents: false,
useTotp: false,
use2fa: false,
useApi: false,
useSso: false,
useKeyConnector: false,
useScim: false,
useCustomPermissions: false,
useResetPassword: false,
useSecretsManager: false,
usePasswordManager: false,
useActivateAutofillPolicy: false,
selfHost: false,
usersGetPremium: false,
seats: 0,
maxCollections: 0,
ssoBound: false,
identifier: "identifier",
permissions: undefined,
resetPasswordEnrolled: false,
userId: "userId",
organizationUserId: "organizationUserId",
hasPublicAndPrivateKeys: false,
providerId: "providerId",
providerName: "providerName",
isProviderUser: false,
isMember: false,
familySponsorshipFriendlyName: "fsfn",
familySponsorshipAvailable: false,
productTierType: ProductTierType.Free,
keyConnectorEnabled: false,
keyConnectorUrl: "kcu",
accessSecretsManager: false,
limitCollectionCreation: false,
limitCollectionDeletion: false,
allowAdminAccessToAllCollectionItems: false,
familySponsorshipLastSyncDate: new Date(),
userIsManagedByOrganization: false,
useRiskInsights: false,
},
};
const result = sut.deserializer(JSON.parse(JSON.stringify(expectedResult)));
expect(result).toEqual(expectedResult);
});
});