@ordergroove/offers 2.35.2 → 2.35.3

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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,14 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [2.35.3](https://github.com/ordergroove/plush-toys/compare/@ordergroove/offers@2.35.2...@ordergroove/offers@2.35.3) (2023-12-07)
7
+
8
+ **Note:** Version bump only for package @ordergroove/offers
9
+
10
+
11
+
12
+
13
+
6
14
  ## [2.35.2](https://github.com/ordergroove/plush-toys/compare/@ordergroove/offers@2.35.1...@ordergroove/offers@2.35.2) (2023-12-05)
7
15
 
8
16
  **Note:** Version bump only for package @ordergroove/offers
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ordergroove/offers",
3
- "version": "2.35.2",
3
+ "version": "2.35.3",
4
4
  "description": "offer state component",
5
5
  "author": "Eugenio Lattanzio <eugenio63@gmail.com>",
6
6
  "homepage": "https://github.com/ordergroove/plush-toys#readme",
@@ -35,7 +35,7 @@
35
35
  }
36
36
  ],
37
37
  "dependencies": {
38
- "@ordergroove/auth": "^2.3.1",
38
+ "@ordergroove/auth": "^2.3.2",
39
39
  "@ordergroove/offers-live-editor": "^0.6.5",
40
40
  "lit-element": "^2.1.0",
41
41
  "lodash.memoize": "^4.1.2",
@@ -48,5 +48,5 @@
48
48
  "@ordergroove/offers-templates": "^0.9.3",
49
49
  "@types/lodash.memoize": "^4.1.9"
50
50
  },
51
- "gitHead": "d1e06c5dec3c827713005c7a2d3558f9ed0d2431"
51
+ "gitHead": "521fa43f980842f76be9c12ab20ed6473ab905f7"
52
52
  }
@@ -195,6 +195,7 @@ describe('Offer', function() {
195
195
  element = document.querySelector('og-select-frequency');
196
196
  await element.updateComplete;
197
197
  await new Promise(r => setTimeout(r, 10));
198
+ // eslint-disable-next-line jasmine/no-expect-in-setup-teardown
198
199
  expect(fetch).toHaveBeenCalledTimes(1);
199
200
  });
200
201
 
@@ -165,7 +165,7 @@ describe('redux actions', function() {
165
165
  sessionId: 'the sessionId',
166
166
  environment: { apiUrl: 'the environment.apiUrl' }
167
167
  });
168
- const fetchOfferSpy = spyOn(api, 'fetchOffer').and.returnValue(Promise.resolve({ hey: 'ho' }));
168
+ const fetchOfferSpy = spyOn(api, 'fetchOffer').and.resolveTo({ hey: 'ho' });
169
169
  await fetchOffer('the product')(this.dispatch, getState);
170
170
  expect(fetchOfferSpy).toHaveBeenCalledWith(
171
171
  'the environment.apiUrl',
@@ -177,7 +177,7 @@ describe('redux actions', function() {
177
177
  });
178
178
 
179
179
  it('should dispatch the receiveOffer if api returns', async () => {
180
- const fetchOfferSpy = spyOn(api, 'fetchOffer').and.returnValue(Promise.resolve({ hey: 'ho' }));
180
+ const fetchOfferSpy = spyOn(api, 'fetchOffer').and.resolveTo({ hey: 'ho' });
181
181
 
182
182
  await fetchOffer('yum product')(this.dispatch, this.getState);
183
183
 
@@ -189,7 +189,7 @@ describe('redux actions', function() {
189
189
  });
190
190
 
191
191
  it('should dispatch fetchResponseError if api fails', async () => {
192
- const fetchOfferSpy = spyOn(api, 'fetchOffer').and.returnValue(Promise.reject(Error({ hey: 'ho' })));
192
+ const fetchOfferSpy = spyOn(api, 'fetchOffer').and.rejectWith(Error({ hey: 'ho' }));
193
193
  await fetchOffer('yum product')(this.dispatch, this.getState);
194
194
 
195
195
  expect(this.dispatch.calls.count()).toEqual(3);
@@ -243,7 +243,7 @@ describe('redux actions', function() {
243
243
 
244
244
  it('fetchAuth should dispatch requestOffer if authUrl and call authResolver', async () => {
245
245
  const dispatch = jasmine.createSpy('dispatch');
246
- const authResolver = jasmine.createSpy('authResolver').and.returnValue(Promise.resolve({}));
246
+ const authResolver = jasmine.createSpy('authResolver').and.resolveTo({});
247
247
  const getState = jasmine.createSpy('getState').and.returnValue({
248
248
  merchantId: 'yum merchant id',
249
249
  authUrl: 'some auth url'
@@ -259,12 +259,12 @@ describe('redux actions', function() {
259
259
 
260
260
  it('fetchAuth should dispatch receiveOffer authResolver succed', async () => {
261
261
  const dispatch = jasmine.createSpy('dispatch');
262
- const authResolver = jasmine.createSpy('authResolver').and.returnValue(
263
- Promise.resolve({
262
+ const authResolver = jasmine.createSpy('authResolver').and.resolveTo(
263
+ {
264
264
  sig_field: 'sig_field',
265
265
  sig: 'sig',
266
266
  ts: 'ts'
267
- })
267
+ }
268
268
  );
269
269
  const getState = jasmine.createSpy('getState').and.returnValue({
270
270
  merchantId: 'yum merchant id',
@@ -277,7 +277,7 @@ describe('redux actions', function() {
277
277
 
278
278
  it('fetchAuth should dispatch unauthorized if authResolver reject', async () => {
279
279
  const dispatch = jasmine.createSpy('dispatch');
280
- const authResolver = jasmine.createSpy('authResolver').and.returnValue(Promise.reject(new Error('some reason')));
280
+ const authResolver = jasmine.createSpy('authResolver').and.rejectWith(new Error('some reason'));
281
281
  const getState = jasmine.createSpy('getState').and.returnValue({
282
282
  merchantId: 'yum merchant id',
283
283
  authUrl: 'some auth url'
@@ -291,7 +291,7 @@ describe('redux actions', function() {
291
291
 
292
292
  describe('actions.iu', () => {
293
293
  it('createIu should dispatch request and receive actions', async () => {
294
- const fetchSpy = spyOn(api, 'createOneTime').and.returnValue(Promise.resolve({ hey: 'ho' }));
294
+ const fetchSpy = spyOn(api, 'createOneTime').and.resolveTo({ hey: 'ho' });
295
295
  const dispatch = jasmine.createSpy('dispatch');
296
296
  const getState = jasmine
297
297
  .createSpy('getState')
@@ -316,7 +316,7 @@ describe('actions.iu', () => {
316
316
  });
317
317
 
318
318
  it('createIu should not call api if previewMode', async () => {
319
- const fetchSpy = spyOn(api, 'createOneTime').and.returnValue(Promise.resolve({ hey: 'ho' }));
319
+ const fetchSpy = spyOn(api, 'createOneTime').and.resolveTo({ hey: 'ho' });
320
320
  const dispatch = jasmine.createSpy('dispatch');
321
321
  const getState = jasmine.createSpy('getState').and.returnValue({
322
322
  previewUpsellOffer: true,
@@ -343,8 +343,8 @@ describe('actions.iu', () => {
343
343
  });
344
344
 
345
345
  it('createIu should dispatch create subscription', async () => {
346
- const fetchSpy = spyOn(api, 'createOneTime').and.returnValue(Promise.resolve({ hey: 'hokk' }));
347
- spyOn(api, 'convertOneTimeToSubscription').and.returnValue(Promise.resolve({ hey: 'hwwo' }));
346
+ const fetchSpy = spyOn(api, 'createOneTime').and.resolveTo({ hey: 'hokk' });
347
+ spyOn(api, 'convertOneTimeToSubscription').and.resolveTo({ hey: 'hwwo' });
348
348
  const dispatch = jasmine.createSpy('dispatch').and.returnValue({ the: 'item' });
349
349
  const getState = jasmine
350
350
  .createSpy('getState')
@@ -1,3 +1,4 @@
1
+ /* eslint-disable jasmine/no-unsafe-spy */
1
2
  import { connect, createRecalcProps, resolveStore, setStore, unsetStore } from '../connect';
2
3
 
3
4
  describe('connect', () => {
@@ -45,7 +45,7 @@ describe('loadState', () => {
45
45
  expect(loadState()).toBe(undefined);
46
46
  });
47
47
 
48
- it('should return undefined on empty state', () => {
48
+ it('should return object for populated state', () => {
49
49
  const yum = {
50
50
  sessionId: 'yum',
51
51
  optedin: 'yum2',
@@ -2063,7 +2063,7 @@ describe('productPlans', () => {
2063
2063
  });
2064
2064
  });
2065
2065
 
2066
- it('should convert product plan values into non-USD currencies given action SETUP_PRODUCT with GBP currency', () => {
2066
+ it('should convert product plan values into non-USD currencies given action SETUP_CART with GBP currency', () => {
2067
2067
  const actual = productPlans({}, getSetupCartActionForRegularProduct('GBP'));
2068
2068
 
2069
2069
  expect(actual).toEqual({