1
1
import Onyx from 'react-native-onyx' ;
2
2
import OnyxUpdateManager from '@libs/actions/OnyxUpdateManager' ;
3
- import * as Tag from '@userActions/Policy/Tag' ;
3
+ import { createPolicyTag , deletePolicyTags , renamePolicyTag , renamePolicyTaglist , setPolicyRequiresTag , setWorkspaceTagEnabled } from '@userActions/Policy/Tag' ;
4
4
import CONST from '@src/CONST' ;
5
5
import ONYXKEYS from '@src/ONYXKEYS' ;
6
6
import type { PolicyTags } from '@src/types/onyx' ;
7
7
import createRandomPolicy from '../utils/collections/policies' ;
8
8
import createRandomPolicyTags from '../utils/collections/policyTags' ;
9
- import * as TestHelper from '../utils/TestHelper' ;
9
+ import { getGlobalFetchMock } from '../utils/TestHelper' ;
10
10
import type { MockFetch } from '../utils/TestHelper' ;
11
11
import waitForBatchedUpdates from '../utils/waitForBatchedUpdates' ;
12
12
@@ -24,7 +24,7 @@ describe('actions/Policy', () => {
24
24
25
25
let mockFetch : MockFetch ;
26
26
beforeEach ( ( ) => {
27
- global . fetch = TestHelper . getGlobalFetchMock ( ) ;
27
+ global . fetch = getGlobalFetchMock ( ) ;
28
28
mockFetch = fetch as MockFetch ;
29
29
return Onyx . clear ( ) . then ( waitForBatchedUpdates ) ;
30
30
} ) ;
@@ -38,7 +38,7 @@ describe('actions/Policy', () => {
38
38
39
39
return Onyx . set ( `${ ONYXKEYS . COLLECTION . POLICY } ${ fakePolicy . id } ` , fakePolicy )
40
40
. then ( ( ) => {
41
- Tag . setPolicyRequiresTag ( fakePolicy . id , true ) ;
41
+ setPolicyRequiresTag ( fakePolicy . id , true ) ;
42
42
return waitForBatchedUpdates ( ) ;
43
43
} )
44
44
. then (
@@ -85,7 +85,7 @@ describe('actions/Policy', () => {
85
85
86
86
return Onyx . set ( `${ ONYXKEYS . COLLECTION . POLICY } ${ fakePolicy . id } ` , fakePolicy )
87
87
. then ( ( ) => {
88
- Tag . setPolicyRequiresTag ( fakePolicy . id , false ) ;
88
+ setPolicyRequiresTag ( fakePolicy . id , false ) ;
89
89
return waitForBatchedUpdates ( ) ;
90
90
} )
91
91
. then (
@@ -133,7 +133,7 @@ describe('actions/Policy', () => {
133
133
return Onyx . set ( `${ ONYXKEYS . COLLECTION . POLICY } ${ fakePolicy . id } ` , fakePolicy )
134
134
. then ( ( ) => {
135
135
mockFetch ?. fail ?.( ) ;
136
- Tag . setPolicyRequiresTag ( fakePolicy . id , false ) ;
136
+ setPolicyRequiresTag ( fakePolicy . id , false ) ;
137
137
return waitForBatchedUpdates ( ) ;
138
138
} )
139
139
@@ -174,7 +174,7 @@ describe('actions/Policy', () => {
174
174
Onyx . set ( `${ ONYXKEYS . COLLECTION . POLICY_TAGS } ${ fakePolicy . id } ` , fakePolicyTags ) ;
175
175
} )
176
176
. then ( ( ) => {
177
- Tag . renamePolicyTaglist (
177
+ renamePolicyTaglist (
178
178
fakePolicy . id ,
179
179
{
180
180
oldName : oldTagListName ,
@@ -242,7 +242,7 @@ describe('actions/Policy', () => {
242
242
. then ( ( ) => {
243
243
mockFetch ?. fail ?.( ) ;
244
244
245
- Tag . renamePolicyTaglist (
245
+ renamePolicyTaglist (
246
246
fakePolicy . id ,
247
247
{
248
248
oldName : oldTagListName ,
@@ -292,7 +292,7 @@ describe('actions/Policy', () => {
292
292
Onyx . set ( `${ ONYXKEYS . COLLECTION . POLICY_TAGS } ${ fakePolicy . id } ` , fakePolicyTags ) ;
293
293
} )
294
294
. then ( ( ) => {
295
- Tag . createPolicyTag ( fakePolicy . id , newTagName ) ;
295
+ createPolicyTag ( fakePolicy . id , newTagName ) ;
296
296
return waitForBatchedUpdates ( ) ;
297
297
} )
298
298
. then (
@@ -354,7 +354,7 @@ describe('actions/Policy', () => {
354
354
. then ( ( ) => {
355
355
mockFetch ?. fail ?.( ) ;
356
356
357
- Tag . createPolicyTag ( fakePolicy . id , newTagName ) ;
357
+ createPolicyTag ( fakePolicy . id , newTagName ) ;
358
358
return waitForBatchedUpdates ( ) ;
359
359
} )
360
360
. then ( mockFetch ?. resume )
@@ -401,7 +401,7 @@ describe('actions/Policy', () => {
401
401
Onyx . set ( `${ ONYXKEYS . COLLECTION . POLICY_TAGS } ${ fakePolicy . id } ` , fakePolicyTags ) ;
402
402
} )
403
403
. then ( ( ) => {
404
- Tag . setWorkspaceTagEnabled ( fakePolicy . id , tagsToUpdate , 0 ) ;
404
+ setWorkspaceTagEnabled ( fakePolicy . id , tagsToUpdate , 0 ) ;
405
405
return waitForBatchedUpdates ( ) ;
406
406
} )
407
407
. then (
@@ -474,7 +474,7 @@ describe('actions/Policy', () => {
474
474
. then ( ( ) => {
475
475
mockFetch ?. fail ?.( ) ;
476
476
477
- Tag . setWorkspaceTagEnabled ( fakePolicy . id , tagsToUpdate , 0 ) ;
477
+ setWorkspaceTagEnabled ( fakePolicy . id , tagsToUpdate , 0 ) ;
478
478
return waitForBatchedUpdates ( ) ;
479
479
} )
480
480
. then ( mockFetch ?. resume )
@@ -520,7 +520,7 @@ describe('actions/Policy', () => {
520
520
Onyx . set ( `${ ONYXKEYS . COLLECTION . POLICY_TAGS } ${ fakePolicy . id } ` , fakePolicyTags ) ;
521
521
} )
522
522
. then ( ( ) => {
523
- Tag . renamePolicyTag (
523
+ renamePolicyTag (
524
524
fakePolicy . id ,
525
525
{
526
526
oldName : oldTagName ?? '' ,
@@ -590,7 +590,7 @@ describe('actions/Policy', () => {
590
590
. then ( ( ) => {
591
591
mockFetch ?. fail ?.( ) ;
592
592
593
- Tag . renamePolicyTag (
593
+ renamePolicyTag (
594
594
fakePolicy . id ,
595
595
{
596
596
oldName : oldTagName ,
@@ -639,7 +639,7 @@ describe('actions/Policy', () => {
639
639
Onyx . set ( `${ ONYXKEYS . COLLECTION . POLICY_TAGS } ${ fakePolicy . id } ` , fakePolicyTags ) ;
640
640
} )
641
641
. then ( ( ) => {
642
- Tag . deletePolicyTags ( fakePolicy . id , tagsToDelete ) ;
642
+ deletePolicyTags ( fakePolicy . id , tagsToDelete ) ;
643
643
return waitForBatchedUpdates ( ) ;
644
644
} )
645
645
. then (
@@ -699,7 +699,7 @@ describe('actions/Policy', () => {
699
699
. then ( ( ) => {
700
700
mockFetch ?. fail ?.( ) ;
701
701
702
- Tag . deletePolicyTags ( fakePolicy . id , tagsToDelete ) ;
702
+ deletePolicyTags ( fakePolicy . id , tagsToDelete ) ;
703
703
return waitForBatchedUpdates ( ) ;
704
704
} )
705
705
. then ( mockFetch ?. resume )
0 commit comments