11import {
2- initStripe ,
3- createElements ,
4- createElement ,
52 ERRORS ,
6- } from '../../src/stripe-elements'
3+ createElement ,
4+ createElements ,
5+ initStripe ,
6+ } from "../../src/stripe-elements"
77
8- describe ( ' initStripe' , ( ) => {
9- test ( ' no key, no options' , ( ) => {
8+ describe ( " initStripe" , ( ) => {
9+ test ( " no key, no options" , ( ) => {
1010 const result = initStripe ( )
1111 expect ( result . message ) . toBe ( ERRORS . STRIPE_NOT_LOADED )
1212 } )
1313
14- test ( ' key, no options' , ( ) => {
15- const key = ' 12345'
14+ test ( " key, no options" , ( ) => {
15+ const key = " 12345"
1616 const mockFn = jest . fn ( )
1717 window . Stripe = mockFn
1818 initStripe ( key )
1919 expect ( mockFn ) . toHaveBeenCalledTimes ( 1 )
2020 expect ( mockFn ) . toHaveBeenCalledWith ( key , undefined )
2121 } )
2222
23- test ( ' key and options' , ( ) => {
24- const key = ' 12345'
25- const options = { c : 'd' }
23+ test ( " key and options" , ( ) => {
24+ const key = " 12345"
25+ const options = { c : "d" }
2626 const mockFn = jest . fn ( )
2727 window . Stripe = mockFn
2828 initStripe ( key , options )
@@ -31,54 +31,54 @@ describe('initStripe', () => {
3131 } )
3232} )
3333
34- describe ( ' createElements' , ( ) => {
35- test ( ' no arguments' , ( ) => {
34+ describe ( " createElements" , ( ) => {
35+ test ( " no arguments" , ( ) => {
3636 const result = createElements ( )
3737 expect ( result . message ) . toBe ( ERRORS . INSTANCE_NOT_DEFINED )
3838 } )
3939
40- test ( ' valid instance' , ( ) => {
40+ test ( " valid instance" , ( ) => {
4141 const mockFn = jest . fn ( )
4242 const instance = { elements : mockFn }
4343 createElements ( instance )
4444 expect ( mockFn ) . toHaveBeenCalledTimes ( 1 )
4545 } )
4646
47- test ( ' options passed' , ( ) => {
47+ test ( " options passed" , ( ) => {
4848 const mockFn = jest . fn ( )
4949 const instance = { elements : mockFn }
50- const options = { a : 'b' }
50+ const options = { a : "b" }
5151 createElements ( instance , options )
5252 expect ( mockFn ) . toHaveBeenCalledTimes ( 1 )
5353 expect ( mockFn ) . toHaveBeenCalledWith ( options )
5454 } )
5555} )
5656
57- describe ( ' createElement' , ( ) => {
58- test ( ' no arguments' , ( ) => {
57+ describe ( " createElement" , ( ) => {
58+ test ( " no arguments" , ( ) => {
5959 const result = createElement ( )
6060 expect ( result . message ) . toBe ( ERRORS . ELEMENTS_NOT_DEFINED )
6161 } )
6262
63- test ( ' valid elements, no type' , ( ) => {
63+ test ( " valid elements, no type" , ( ) => {
6464 const elements = { }
6565 const result = createElement ( elements )
6666 expect ( result . message ) . toBe ( ERRORS . ELEMENT_TYPE_NOT_DEFINED )
6767 } )
6868
69- test ( ' valid elements, valid type' , ( ) => {
69+ test ( " valid elements, valid type" , ( ) => {
7070 const mockFn = jest . fn ( )
7171 const elements = { create : mockFn }
72- const type = ' card'
72+ const type = " card"
7373 createElement ( elements , type )
7474 expect ( mockFn ) . toHaveBeenCalledTimes ( 1 )
7575 } )
7676
77- test ( ' options passed' , ( ) => {
77+ test ( " options passed" , ( ) => {
7878 const mockFn = jest . fn ( )
7979 const elements = { create : mockFn }
80- const type = ' card'
81- const options = { b : 'c' }
80+ const type = " card"
81+ const options = { b : "c" }
8282 createElement ( elements , type , options )
8383 expect ( mockFn ) . toHaveBeenCalledTimes ( 1 )
8484 expect ( mockFn ) . toHaveBeenCalledWith ( type , options )
0 commit comments