From daec245ffb1f6c5ea9001a47cb84a26717c45502 Mon Sep 17 00:00:00 2001 From: StephanGerbeth Date: Sun, 24 Nov 2024 22:18:43 +0100 Subject: [PATCH 1/2] fix(operators): cleanup --- package-lock.json | 4 ++-- packages/operators/src/request/cache.test.js | 19 +++++++++-------- packages/operators/src/request/retry.test.js | 22 +++++++++----------- 3 files changed, 22 insertions(+), 23 deletions(-) diff --git a/package-lock.json b/package-lock.json index abf4cc2..08078d1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12535,7 +12535,7 @@ }, "packages/observables": { "name": "@rxjs-collection/observables", - "version": "1.0.5-beta.1", + "version": "1.0.5", "license": "MIT", "dependencies": { "@rxjs-collection/operators": "*", @@ -12544,7 +12544,7 @@ }, "packages/operators": { "name": "@rxjs-collection/operators", - "version": "1.0.6-beta.3", + "version": "1.0.6", "license": "MIT", "dependencies": { "@rxjs-collection/observables": "*", diff --git a/packages/operators/src/request/cache.test.js b/packages/operators/src/request/cache.test.js index bdaa853..f0af385 100644 --- a/packages/operators/src/request/cache.test.js +++ b/packages/operators/src/request/cache.test.js @@ -12,26 +12,27 @@ describe('cache', () => { }); test('default', () => { - const initial = new Response('initial', { status: 200 }); - const updated = new Response('updated', { status: 200 }); - const orderedResponses = [initial, updated]; + const expectedVal = { + a: new Response('initial', { status: 200 }), + b: new Response('updated', { status: 200 }) + }; + + const triggerVal = [expectedVal.a, expectedVal.b]; testScheduler.run(({ cold, expectObservable }) => { - const stream = cold('a', { - a: () => orderedResponses.shift() - }).pipe( + const stream = cold('a', { a: () => triggerVal.shift() }).pipe( map(fn => fn()), cache(2) ); const unsubA = '-^!'; - expectObservable(stream, unsubA).toBe('-a', { a: initial }, new Error()); + expectObservable(stream, unsubA).toBe('-a', expectedVal, new Error()); const unsubB = '----^!'; - expectObservable(stream, unsubB).toBe('----a', { a: initial }, new Error()); + expectObservable(stream, unsubB).toBe('----a', expectedVal, new Error()); const unsubC = '---------^--!'; - expectObservable(stream, unsubC).toBe('---------a', { a: updated }, new Error()); + expectObservable(stream, unsubC).toBe('---------b', expectedVal, new Error()); }); }); }); diff --git a/packages/operators/src/request/retry.test.js b/packages/operators/src/request/retry.test.js index 62b8760..16bddbd 100644 --- a/packages/operators/src/request/retry.test.js +++ b/packages/operators/src/request/retry.test.js @@ -1,6 +1,6 @@ import { map } from 'rxjs'; import { TestScheduler } from 'rxjs/testing'; -import { afterEach, beforeEach, describe, expect, test } from 'vitest'; +import { beforeEach, describe, expect, test } from 'vitest'; import { log } from '../log'; import { networkRetry } from './retry'; @@ -12,28 +12,26 @@ describe('request retry', () => { testScheduler = new TestScheduler((actual, expected) => expect(actual).deep.equal(expected)); }); - afterEach(() => { - // - }); - test('2x error -> 1x success', () => { - const error = new Response('', { status: 500 }); - const success = new Response('a', { status: 200 }); - const orderedResponses = [error, error, success]; + const expectedVal = { + a: new Response('', { status: 500 }), + b: new Response('', { status: 500 }), + c: new Response('a', { status: 200 }) + }; + + const triggerVal = [expectedVal.a, expectedVal.b, expectedVal.c]; testScheduler.run(({ cold, expectObservable }) => { // retry is repeating the sequence // if you define a delay, you have to add the delay to the subscribe multiple times (num retries) - const stream = cold('a|', { - a: () => orderedResponses.shift() - }).pipe( + const stream = cold('a|', { a: () => triggerVal.shift() }).pipe( map(fn => fn()), networkRetry({ timeout: () => 5 }), log('marble:result') ); const unsubA = '^-----------'; - expectObservable(stream, unsubA).toBe('----------a|', { a: success }); + expectObservable(stream, unsubA).toBe('----------c|', expectedVal); }); }); }); From 271e580b8e8394dd19de5f6b6d194dd22aa25a0a Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Sun, 24 Nov 2024 21:21:27 +0000 Subject: [PATCH 2/2] chore(release): 1.0.7-beta.1 [skip ci] # [@rxjs-collection/operators-v1.0.7-beta.1](https://github.com/basics/rxjs-collection/compare/@rxjs-collection/operators-v1.0.6...@rxjs-collection/operators-v1.0.7-beta.1) (2024-11-24) ### Bug Fixes * **operators:** cleanup ([daec245](https://github.com/basics/rxjs-collection/commit/daec245ffb1f6c5ea9001a47cb84a26717c45502)) --- packages/operators/CHANGELOG.md | 7 +++++++ packages/operators/package.json | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/operators/CHANGELOG.md b/packages/operators/CHANGELOG.md index fee2965..9a80605 100644 --- a/packages/operators/CHANGELOG.md +++ b/packages/operators/CHANGELOG.md @@ -1,5 +1,12 @@ # Project Changelog +# [@rxjs-collection/operators-v1.0.7-beta.1](https://github.com/basics/rxjs-collection/compare/@rxjs-collection/operators-v1.0.6...@rxjs-collection/operators-v1.0.7-beta.1) (2024-11-24) + + +### Bug Fixes + +* **operators:** cleanup ([daec245](https://github.com/basics/rxjs-collection/commit/daec245ffb1f6c5ea9001a47cb84a26717c45502)) + # [@rxjs-collection/operators-v1.0.6](https://github.com/basics/rxjs-collection/compare/@rxjs-collection/operators-v1.0.5...@rxjs-collection/operators-v1.0.6) (2024-11-24) diff --git a/packages/operators/package.json b/packages/operators/package.json index 01cdf31..916fcde 100644 --- a/packages/operators/package.json +++ b/packages/operators/package.json @@ -1,6 +1,6 @@ { "name": "@rxjs-collection/operators", - "version": "1.0.6", + "version": "1.0.7-beta.1", "description": "rxjs operators", "license": "MIT", "contributors": [