@@ -2,9 +2,16 @@ import useGqlHandler from "./useGqlHandler";
2
2
import { GET_SETTINGS } from "~tests/graphql/formBuilderSettings" ;
3
3
4
4
describe ( "Settings Test" , ( ) => {
5
- const { getSettings, updateSettings, install, createI18NLocale, isInstalled } = useGqlHandler ( ) ;
6
-
7
- test ( `Should not be able to get & update settings before "install"` , async ( ) => {
5
+ const {
6
+ getSettings,
7
+ updateSettings,
8
+ install,
9
+ createI18NLocale,
10
+ deleteI18NLocale,
11
+ isInstalled
12
+ } = useGqlHandler ( ) ;
13
+
14
+ it ( `Should not be able to get & update settings before "install"` , async ( ) => {
8
15
// Should not have any settings without install
9
16
const [ getSettingsResponse ] = await getSettings ( ) ;
10
17
@@ -40,7 +47,7 @@ describe("Settings Test", () => {
40
47
} ) ;
41
48
} ) ;
42
49
43
- test ( "Should be able to install `Form Builder`" , async ( ) => {
50
+ it ( "Should be able to install `Form Builder`" , async ( ) => {
44
51
// "isInstalled" should return false prior "install"
45
52
const [ isInstalledResponse ] = await isInstalled ( ) ;
46
53
@@ -78,7 +85,7 @@ describe("Settings Test", () => {
78
85
} ) ;
79
86
} ) ;
80
87
81
- test ( `Should be able to get & update settings after "install"` , async ( ) => {
88
+ it ( `Should be able to get & update settings after "install"` , async ( ) => {
82
89
// Let's install the `Form builder`
83
90
const [ installResponse ] = await install ( { domain : "http://localhost:3001" } ) ;
84
91
@@ -156,7 +163,7 @@ describe("Settings Test", () => {
156
163
} ) ;
157
164
} ) ;
158
165
159
- test ( `Should be able to get & update settings after in a new locale` , async ( ) => {
166
+ it ( `Should be able to get & update settings after in a new locale` , async ( ) => {
160
167
// Let's install the `Form builder`
161
168
await install ( { domain : "http://localhost:3001" } ) ;
162
169
@@ -168,9 +175,7 @@ describe("Settings Test", () => {
168
175
// set the locale header. Wasn't easily possible via the `getSettings` helper.
169
176
const [ newLocaleFbSettings ] = await invoke ( {
170
177
body : { query : GET_SETTINGS } ,
171
- headers : {
172
- "x-i18n-locale" : "default:de-DE;content:de-DE;"
173
- }
178
+ headers : { "x-i18n-locale" : "default:de-DE;content:de-DE;" }
174
179
} ) ;
175
180
176
181
// Settings should exist in the newly created locale.
@@ -192,4 +197,38 @@ describe("Settings Test", () => {
192
197
}
193
198
} ) ;
194
199
} ) ;
200
+
201
+ it ( `Should be able to create a locale, delete it, and again create it` , async ( ) => {
202
+ // Let's install the `Form builder`
203
+ await install ( { domain : "http://localhost:3001" } ) ;
204
+
205
+ await createI18NLocale ( { data : { code : "en-US" } } ) ;
206
+ await createI18NLocale ( { data : { code : "de-DE" } } ) ;
207
+
208
+ const [ deleteDeLocaleResponse ] = await deleteI18NLocale ( { code : "de-DE" } ) ;
209
+ expect ( deleteDeLocaleResponse ) . toEqual ( {
210
+ data : {
211
+ i18n : {
212
+ deleteI18NLocale : {
213
+ data : { code : "de-DE" } ,
214
+ error : null
215
+ }
216
+ }
217
+ }
218
+ } ) ;
219
+
220
+ const [ createDeLocaleResponse ] = await createI18NLocale ( { data : { code : "de-DE" } } ) ;
221
+ expect ( createDeLocaleResponse ) . toEqual ( {
222
+ data : {
223
+ i18n : {
224
+ createI18NLocale : {
225
+ data : {
226
+ code : "de-DE"
227
+ } ,
228
+ error : null
229
+ }
230
+ }
231
+ }
232
+ } ) ;
233
+ } ) ;
195
234
} ) ;
0 commit comments