Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions packages/observables/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Project Changelog

# [@rxjs-collection/observables-v1.0.5](https://github.com/basics/rxjs-collection/compare/@rxjs-collection/observables-v1.0.4...@rxjs-collection/observables-v1.0.5) (2024-11-24)


### Bug Fixes

* **operators:** cleanup and standardize tests ([aabbbd8](https://github.com/basics/rxjs-collection/commit/aabbbd89bd76ca57cfd20b747890fcc74ee01227))

# [@rxjs-collection/observables-v1.0.5-beta.1](https://github.com/basics/rxjs-collection/compare/@rxjs-collection/observables-v1.0.4...@rxjs-collection/observables-v1.0.5-beta.1) (2024-11-24)


Expand Down
2 changes: 1 addition & 1 deletion packages/observables/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rxjs-collection/observables",
"version": "1.0.5-beta.1",
"version": "1.0.5",
"description": "rxjs observables",
"license": "MIT",
"contributors": [
Expand Down
12 changes: 12 additions & 0 deletions packages/operators/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# Project Changelog

# [@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)


### Bug Fixes

* **deps:** pin dependencies ([fbaaf8a](https://github.com/basics/rxjs-collection/commit/fbaaf8ae9723e6960782b5cd96c2be5ce38a170c))
* **fetch:** additional stuff ([4ab3e81](https://github.com/basics/rxjs-collection/commit/4ab3e8164d2fb347191b35e87c3ac33a2d1922f5))
* **operators:** added fetch tests ([84b2614](https://github.com/basics/rxjs-collection/commit/84b26147bae6a8ee2a6010a0f52884900d63761e))
* **operators:** cleanup and standardize tests ([aabbbd8](https://github.com/basics/rxjs-collection/commit/aabbbd89bd76ca57cfd20b747890fcc74ee01227))
* **operators:** marble testing ([2b5f78b](https://github.com/basics/rxjs-collection/commit/2b5f78bacbbae30ab02f62d1e603816cadba03ee))
* **operators:** optimized tests ([bd3c5ef](https://github.com/basics/rxjs-collection/commit/bd3c5ef521b87be36fde61e292f81e92297b16d6))

# [@rxjs-collection/operators-v1.0.6-beta.3](https://github.com/basics/rxjs-collection/compare/@rxjs-collection/operators-v1.0.6-beta.2...@rxjs-collection/operators-v1.0.6-beta.3) (2024-11-24)


Expand Down
2 changes: 1 addition & 1 deletion packages/operators/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rxjs-collection/operators",
"version": "1.0.6-beta.3",
"version": "1.0.6",
"description": "rxjs operators",
"license": "MIT",
"contributors": [
Expand Down
19 changes: 10 additions & 9 deletions packages/operators/src/request/cache.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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());
});
});
});
22 changes: 10 additions & 12 deletions packages/operators/src/request/retry.test.js
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -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);
});
});
});
Loading