1
-
2
1
/**
3
2
* @jest -environment jsdom
4
3
*/
5
-
6
-
7
- import React , { useState } from 'react' ;
8
4
import useFWScript from '../src/script' ;
9
5
import useFW from '../src/useFW' ;
10
- import { renderHook } from " @testing-library/react" ;
6
+ import { renderHook } from ' @testing-library/react' ;
11
7
12
- import '@testing-library/jest-dom'
8
+ import '@testing-library/jest-dom' ;
13
9
14
10
15
11
test ( 'FlutterwaveModule should create' , ( ) => {
16
- const { result} = renderHook ( ( ) => useFWScript ( ) )
17
-
12
+ const { result} = renderHook ( ( ) => useFWScript ( { } ) ) ;
13
+
18
14
expect (
19
15
result . current [ 0 ]
20
16
) . not . toBeTruthy ( ) ;
21
-
22
- } )
17
+ } ) ;
23
18
24
- test ( 'should load Flutterwave Inline script and have FlutterwaveCheckout function' , ( ) => {
19
+ test ( 'Should load Flutterwave Inline script and have FlutterwaveCheckout function' , ( ) => {
25
20
const config = {
26
- public_key : " FLWPUBK-**************************-X" ,
27
- tx_ref : " text_ref1234" ,
21
+ public_key : ' FLWPUBK-**************************-X' ,
22
+ tx_ref : ' text_ref1234' ,
28
23
amount : 10 ,
29
24
currency : 'NGN' ,
30
25
payment_options : 'card,mobilemoney,ussd' ,
@@ -33,21 +28,17 @@ test('should load Flutterwave Inline script and have FlutterwaveCheckout functio
33
28
phone_number : '08102909304' ,
34
29
name : 'test user' ,
35
30
} ,
36
-
37
31
customizations : {
38
32
title : 'My store' ,
39
33
description : 'Payment for items in cart' ,
40
34
logo : 'https://assets.piedpiper.com/logo.png' ,
41
35
} ,
42
-
43
-
44
36
} ;
45
37
46
- const { result} = renderHook ( ( ) => useFW ( config ) )
38
+ const { result} = renderHook ( ( ) => useFW ( config ) ) ;
47
39
48
- expect (
49
- document . querySelector ( `script[src="https://checkout.flutterwave.com/v3.js"]` )
50
- ) . not . toBeNull ( ) ;
51
-
52
- } )
40
+ expect (
41
+ document . querySelector ( 'script[src="https://checkout.flutterwave.com/v3.js"]' )
42
+ ) . not . toBeNull ( ) ;
43
+ } ) ;
53
44
0 commit comments