@@ -18,7 +18,6 @@ import {
1818 getEligibleBankAccountShareRecipients ,
1919 getManagerAccountID ,
2020 getPolicyEmployeeAccountIDs ,
21- getPolicyNameByID ,
2221 getRateDisplayValue ,
2322 getSubmitToAccountID ,
2423 getTagApproverRule ,
@@ -33,7 +32,6 @@ import {
3332 hasOnlyPersonalPolicies ,
3433 hasOtherControlWorkspaces ,
3534 hasPolicyWithXeroConnection ,
36- isCurrentUserMemberOfAnyPolicy ,
3735 isPolicyMemberWithoutPendingDelete ,
3836 shouldShowPolicy ,
3937 sortPoliciesByName ,
@@ -779,31 +777,6 @@ describe('PolicyUtils', () => {
779777 } ) ;
780778 } ) ;
781779
782- describe ( 'getPolicyNameByID' , ( ) => {
783- it ( 'should return the policy name for a given policyID' , async ( ) => {
784- const policy : Policy = {
785- ...createRandomPolicy ( 1 , CONST . POLICY . TYPE . TEAM ) ,
786- name : 'testName' ,
787- } ;
788-
789- await Onyx . set ( `${ ONYXKEYS . COLLECTION . POLICY } 1` , policy ) ;
790-
791- expect ( getPolicyNameByID ( '1' ) ) . toBe ( 'testName' ) ;
792- } ) ;
793-
794- it ( 'should return the empty if the name is not set' , async ( ) => {
795- const policy : Policy = {
796- ...createRandomPolicy ( 1 , CONST . POLICY . TYPE . TEAM ) ,
797- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
798- name : null ! ,
799- } ;
800-
801- await Onyx . set ( `${ ONYXKEYS . COLLECTION . POLICY } 1` , policy ) ;
802-
803- expect ( getPolicyNameByID ( '1' ) ) . toBe ( '' ) ;
804- } ) ;
805- } ) ;
806-
807780 describe ( 'getManagerAccountID' , ( ) => {
808781 beforeEach ( ( ) => {
809782 wrapOnyxWithWaitForBatchedUpdates ( Onyx ) ;
@@ -978,79 +951,6 @@ describe('PolicyUtils', () => {
978951 } ) ;
979952 } ) ;
980953
981- describe ( 'isCurrentUserMemberOfAnyPolicy' , ( ) => {
982- beforeEach ( ( ) => {
983- wrapOnyxWithWaitForBatchedUpdates ( Onyx ) ;
984- } ) ;
985- afterEach ( async ( ) => {
986- await Onyx . clear ( ) ;
987- await waitForBatchedUpdatesWithAct ( ) ;
988- } ) ;
989-
990- it ( 'should return false if user has no policies' , async ( ) => {
991- const currentUserLogin = approverEmail ;
992- const currentUserAccountID = approverAccountID ;
993-
994- await Onyx . set ( ONYXKEYS . SESSION , { email : currentUserLogin , accountID : currentUserAccountID } ) ;
995- await Onyx . set ( ONYXKEYS . COLLECTION . POLICY , { } ) ;
996-
997- const result = isCurrentUserMemberOfAnyPolicy ( ) ;
998-
999- expect ( result ) . toBeFalsy ( ) ;
1000- } ) ;
1001-
1002- it ( 'should return true if user owns a workspace' , async ( ) => {
1003- const currentUserLogin = approverEmail ;
1004- const currentUserAccountID = approverAccountID ;
1005- const policies = { ...createRandomPolicy ( 0 , CONST . POLICY . TYPE . TEAM , `John's Workspace` ) , ownerAccountID : approverAccountID , isPolicyExpenseChatEnabled : true } ;
1006-
1007- await Onyx . set ( ONYXKEYS . SESSION , { email : currentUserLogin , accountID : currentUserAccountID } ) ;
1008- await Onyx . set ( ONYXKEYS . COLLECTION . POLICY , policies ) ;
1009-
1010- const result = isCurrentUserMemberOfAnyPolicy ( ) ;
1011-
1012- expect ( result ) . toBeTruthy ( ) ;
1013- } ) ;
1014-
1015- it ( 'should return false if expense chat is not enabled' , async ( ) => {
1016- const currentUserLogin = approverEmail ;
1017- const currentUserAccountID = approverAccountID ;
1018- const policies = { ...createRandomPolicy ( 0 , CONST . POLICY . TYPE . TEAM , `John's Workspace` ) , isPolicyExpenseChatEnabled : false } ;
1019-
1020- await Onyx . set ( ONYXKEYS . SESSION , { email : currentUserLogin , accountID : currentUserAccountID } ) ;
1021- await Onyx . set ( ONYXKEYS . COLLECTION . POLICY , policies ) ;
1022-
1023- const result = isCurrentUserMemberOfAnyPolicy ( ) ;
1024-
1025- expect ( result ) . toBeFalsy ( ) ;
1026- } ) ;
1027-
1028- it ( 'should return false if its a fake policy id' , async ( ) => {
1029- const currentUserLogin = approverEmail ;
1030- const currentUserAccountID = approverAccountID ;
1031- const policies = { ...createRandomPolicy ( 0 , CONST . POLICY . TYPE . TEAM , `John's Workspace` ) , id : CONST . POLICY . ID_FAKE } ;
1032-
1033- await Onyx . set ( ONYXKEYS . SESSION , { email : currentUserLogin , accountID : currentUserAccountID } ) ;
1034- await Onyx . set ( ONYXKEYS . COLLECTION . POLICY , policies ) ;
1035-
1036- const result = isCurrentUserMemberOfAnyPolicy ( ) ;
1037-
1038- expect ( result ) . toBeFalsy ( ) ;
1039- } ) ;
1040-
1041- it ( 'should return true if user is invited to a workspace' , async ( ) => {
1042- const currentUserLogin = approverEmail ;
1043- const currentUserAccountID = approverAccountID ;
1044- const policies = { ...createRandomPolicy ( 0 , CONST . POLICY . TYPE . TEAM , `John's Workspace` ) , ownerAccountID, isPolicyExpenseChatEnabled : true } ;
1045-
1046- await Onyx . set ( ONYXKEYS . SESSION , { email : currentUserLogin , accountID : currentUserAccountID } ) ;
1047- await Onyx . set ( ONYXKEYS . COLLECTION . POLICY , policies ) ;
1048-
1049- const result = isCurrentUserMemberOfAnyPolicy ( ) ;
1050-
1051- expect ( result ) . toBeTruthy ( ) ;
1052- } ) ;
1053- } ) ;
1054954 describe ( 'getTagList' , ( ) => {
1055955 it . each ( [
1056956 [ 'when index is 0' , 0 , policyTags . TagListTest0 . name ] ,
0 commit comments