@rebilly/instruments 3.29.3 → 3.31.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -25,7 +25,11 @@ describe('RebillyInstruments instance', () => {
25
25
  const options = {
26
26
  form: '.form-selector',
27
27
  summary: '.summary-selector',
28
- items: [],
28
+ apiMode: 'sandbox',
29
+ items: [{
30
+ planId: 'test-plan-id',
31
+ quantity: 1,
32
+ }],
29
33
  setupFramepay: setupFramepayMock,
30
34
  };
31
35
 
@@ -1,7 +1,7 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
3
  exports[`RebillyInstruments theme builds the theme object 1`] = `
4
- Object {
4
+ {
5
5
  "cssVars": "--rebilly-colorPrimary: #0044D4;
6
6
  --rebilly-colorBackground: #FFFFFF;
7
7
  --rebilly-colorText: #0D2B3E;
@@ -78,6 +78,7 @@ export async function RenderMockRebillyInstruments(options = {}) {
78
78
  form: '.form-selector',
79
79
  summary: '.summary-selector',
80
80
  locale: 'auto',
81
+ apiMode: 'sandbox',
81
82
  _dev: {
82
83
  paymentMethodsUrl: 'https://forms.test.rebilly.dev',
83
84
  framePayStyleLink: 'https://dev.framepay.rebilly.com/rebilly.css'
@@ -100,6 +101,10 @@ export async function RenderMockRebillyInstruments(options = {}) {
100
101
  ];
101
102
  }
102
103
 
104
+ if ((options.invoiceId || options.transactionid) && !options.jwt) {
105
+ defaultOptions.jwt = 'test-jwt';
106
+ }
107
+
103
108
  const mergedOptions = merge({...defaultOptions}, options);
104
109
 
105
110
  const framepayMock = createFramepayMock();
@@ -113,16 +118,20 @@ export async function RenderMockRebillyInstruments(options = {}) {
113
118
  summary.classList.add(`${mergedOptions.summary.replace('.', '')}`);
114
119
  document.body.appendChild(summary);
115
120
 
116
- await RebillyInstruments.mount({
117
- setupFramepay: setupFramepayMock,
118
- ...mergedOptions,
119
- });
120
-
121
- RebillyInstruments.mock = {
122
- data: (data) => {
123
- RebillyInstruments.state.data = new DataInstance(data);
124
- }
125
- };
121
+ try {
122
+ await RebillyInstruments.mount({
123
+ setupFramepay: setupFramepayMock,
124
+ ...mergedOptions,
125
+ });
126
+
127
+ RebillyInstruments.mock = {
128
+ data: (data) => {
129
+ RebillyInstruments.state.data = new DataInstance(data);
130
+ }
131
+ };
132
+ } catch(e) {
133
+ console.log(e);
134
+ }
126
135
 
127
136
  return RebillyInstruments;
128
137
  }