@@ -50,6 +50,7 @@ import { filterRecording } from "../utils/PollyUtils";
50
50
import * as AmConfigOps from "./AmConfigOps" ;
51
51
import { state } from "../lib/FrodoLib" ;
52
52
import Constants from "../shared/Constants" ;
53
+ import { getResults } from "../utils/ExportImportUtils" ;
53
54
54
55
const ctx = autoSetupPolly ( ) ;
55
56
@@ -98,31 +99,35 @@ describe('AmConfigOps', () => {
98
99
} ) ;
99
100
100
101
test ( '1: Export AM Config Entities' , async ( ) => {
101
- const response = await AmConfigOps . exportAmConfigEntities ( { includeReadOnly : true , onlyRealm : false , onlyGlobal : false , state } ) ;
102
- expect ( response ) . toMatchSnapshot ( {
103
- meta : expect . any ( Object ) ,
102
+ const results = await getResults ( AmConfigOps . exportAmConfigEntities , { includeReadOnly : true , onlyRealm : false , onlyGlobal : false , state } ) ;
103
+ expect ( results . result ) . toMatchSnapshot ( {
104
+ meta : expect . any ( Object )
104
105
} ) ;
106
+ expect ( results . error ?. getCombinedMessage ( ) ) . toMatchSnapshot ( ) ;
105
107
} ) ;
106
108
107
109
test ( '2: Export importable AM Config Entities' , async ( ) => {
108
- const response = await AmConfigOps . exportAmConfigEntities ( { includeReadOnly : false , onlyRealm : false , onlyGlobal : false , state } ) ;
109
- expect ( response ) . toMatchSnapshot ( {
110
- meta : expect . any ( Object ) ,
110
+ const results = await getResults ( AmConfigOps . exportAmConfigEntities , { includeReadOnly : false , onlyRealm : false , onlyGlobal : false , state } ) ;
111
+ expect ( results . result ) . toMatchSnapshot ( {
112
+ meta : expect . any ( Object )
111
113
} ) ;
114
+ expect ( results . error ?. getCombinedMessage ( ) ) . toMatchSnapshot ( ) ;
112
115
} ) ;
113
116
114
117
test ( '3: Export alpha realm AM Config Entities' , async ( ) => {
115
- const response = await AmConfigOps . exportAmConfigEntities ( { includeReadOnly : true , onlyRealm : true , onlyGlobal : false , state } ) ;
116
- expect ( response ) . toMatchSnapshot ( {
117
- meta : expect . any ( Object ) ,
118
+ const results = await getResults ( AmConfigOps . exportAmConfigEntities , { includeReadOnly : true , onlyRealm : true , onlyGlobal : false , state } ) ;
119
+ expect ( results . result ) . toMatchSnapshot ( {
120
+ meta : expect . any ( Object )
118
121
} ) ;
122
+ expect ( results . error ?. getCombinedMessage ( ) ) . toMatchSnapshot ( ) ;
119
123
} ) ;
120
124
121
125
test ( '4: Export global AM Config Entities' , async ( ) => {
122
- const response = await AmConfigOps . exportAmConfigEntities ( { includeReadOnly : true , onlyRealm : false , onlyGlobal : true , state } ) ;
123
- expect ( response ) . toMatchSnapshot ( {
124
- meta : expect . any ( Object ) ,
126
+ const results = await getResults ( AmConfigOps . exportAmConfigEntities , { includeReadOnly : true , onlyRealm : false , onlyGlobal : true , state } ) ;
127
+ expect ( results . result ) . toMatchSnapshot ( {
128
+ meta : expect . any ( Object )
125
129
} ) ;
130
+ expect ( results . error ?. getCombinedMessage ( ) ) . toMatchSnapshot ( ) ;
126
131
} ) ;
127
132
} ) ;
128
133
@@ -149,31 +154,35 @@ describe('AmConfigOps', () => {
149
154
150
155
describe ( 'exportAmConfigEntities()' , ( ) => {
151
156
test ( '5: Export AM Config Entities' , async ( ) => {
152
- const response = await AmConfigOps . exportAmConfigEntities ( { includeReadOnly : true , onlyRealm : false , onlyGlobal : false , state } ) ;
153
- expect ( response ) . toMatchSnapshot ( {
154
- meta : expect . any ( Object ) ,
157
+ const results = await getResults ( AmConfigOps . exportAmConfigEntities , { includeReadOnly : true , onlyRealm : false , onlyGlobal : false , state } ) ;
158
+ expect ( results . result ) . toMatchSnapshot ( {
159
+ meta : expect . any ( Object )
155
160
} ) ;
161
+ expect ( results . error ?. getCombinedMessage ( ) ) . toMatchSnapshot ( ) ;
156
162
} ) ;
157
163
158
164
test ( '6: Export importable AM Config Entities' , async ( ) => {
159
- const response = await AmConfigOps . exportAmConfigEntities ( { includeReadOnly : false , onlyRealm : false , onlyGlobal : false , state } ) ;
160
- expect ( response ) . toMatchSnapshot ( {
161
- meta : expect . any ( Object ) ,
165
+ const results = await getResults ( AmConfigOps . exportAmConfigEntities , { includeReadOnly : false , onlyRealm : false , onlyGlobal : false , state } ) ;
166
+ expect ( results . result ) . toMatchSnapshot ( {
167
+ meta : expect . any ( Object )
162
168
} ) ;
169
+ expect ( results . error ?. getCombinedMessage ( ) ) . toMatchSnapshot ( ) ;
163
170
} ) ;
164
171
165
172
test ( '7: Export root realm AM Config Entities' , async ( ) => {
166
- const response = await AmConfigOps . exportAmConfigEntities ( { includeReadOnly : true , onlyRealm : true , onlyGlobal : false , state } ) ;
167
- expect ( response ) . toMatchSnapshot ( {
168
- meta : expect . any ( Object ) ,
173
+ const results = await getResults ( AmConfigOps . exportAmConfigEntities , { includeReadOnly : true , onlyRealm : true , onlyGlobal : false , state } ) ;
174
+ expect ( results . result ) . toMatchSnapshot ( {
175
+ meta : expect . any ( Object )
169
176
} ) ;
177
+ expect ( results . error ?. getCombinedMessage ( ) ) . toMatchSnapshot ( ) ;
170
178
} ) ;
171
179
172
180
test ( '8: Export global AM Config Entities' , async ( ) => {
173
- const response = await AmConfigOps . exportAmConfigEntities ( { includeReadOnly : true , onlyRealm : false , onlyGlobal : true , state } ) ;
174
- expect ( response ) . toMatchSnapshot ( {
175
- meta : expect . any ( Object ) ,
181
+ const results = await getResults ( AmConfigOps . exportAmConfigEntities , { includeReadOnly : true , onlyRealm : false , onlyGlobal : true , state } ) ;
182
+ expect ( results . result ) . toMatchSnapshot ( {
183
+ meta : expect . any ( Object )
176
184
} ) ;
185
+ expect ( results . error ?. getCombinedMessage ( ) ) . toMatchSnapshot ( ) ;
177
186
} ) ;
178
187
} ) ;
179
188
0 commit comments