diff --git a/packages/mock/async.js b/packages/mocks/async.js similarity index 100% rename from packages/mock/async.js rename to packages/mocks/async.js diff --git a/packages/mock/network.js b/packages/mocks/network.js similarity index 100% rename from packages/mock/network.js rename to packages/mocks/network.js diff --git a/packages/mock/response.js b/packages/mocks/response.js similarity index 100% rename from packages/mock/response.js rename to packages/mocks/response.js diff --git a/packages/observables/package.json b/packages/observables/package.json index c24571d..1d117ba 100644 --- a/packages/observables/package.json +++ b/packages/observables/package.json @@ -17,6 +17,9 @@ "scripts": { "release": "npx semantic-release" }, + "imports": { + "#mocks/*": "../mocks/*" + }, "dependencies": { "@rxjs-collection/operators": "*", "rxjs": "7.8.1" diff --git a/packages/observables/src/dom/window.test.js b/packages/observables/src/dom/window.test.js index 407926d..269e445 100644 --- a/packages/observables/src/dom/window.test.js +++ b/packages/observables/src/dom/window.test.js @@ -1,8 +1,8 @@ +import { mockOffline, mockOnline, mockReset } from '#mocks/network.js'; import { tap } from 'rxjs'; import { TestScheduler } from 'rxjs/testing'; import { beforeEach, test, expect, describe, afterEach } from 'vitest'; -import { mockOffline, mockOnline, mockReset } from '../../../mock/network.js'; import { connectionObservable } from './window.js'; // HINT: https://betterprogramming.pub/rxjs-testing-write-unit-tests-for-observables-603af959e251 diff --git a/packages/operators/CHANGELOG.md b/packages/operators/CHANGELOG.md index 9987d47..f70b878 100644 --- a/packages/operators/CHANGELOG.md +++ b/packages/operators/CHANGELOG.md @@ -1,5 +1,12 @@ # Project Changelog +# [@rxjs-collection/operators-v1.0.9](https://github.com/basics/rxjs-collection/compare/@rxjs-collection/operators-v1.0.8...@rxjs-collection/operators-v1.0.9) (2024-11-24) + + +### Bug Fixes + +* **operators:** remove skips from coverage ([62652b1](https://github.com/basics/rxjs-collection/commit/62652b13635e35a348d9ae134e389a3a1f39aa59)) + # [@rxjs-collection/operators-v1.0.9-beta.1](https://github.com/basics/rxjs-collection/compare/@rxjs-collection/operators-v1.0.8...@rxjs-collection/operators-v1.0.9-beta.1) (2024-11-24) diff --git a/packages/operators/package.json b/packages/operators/package.json index 51b4222..972590d 100644 --- a/packages/operators/package.json +++ b/packages/operators/package.json @@ -1,6 +1,6 @@ { "name": "@rxjs-collection/operators", - "version": "1.0.9-beta.1", + "version": "1.0.9", "description": "rxjs operators", "license": "MIT", "contributors": [ @@ -17,6 +17,10 @@ "scripts": { "release": "npx semantic-release" }, + "imports": { + "#observables/*": "../observables/src/*", + "#mocks/*": "../mocks/*" + }, "dependencies": { "@rxjs-collection/observables": "*", "ansi-colors": "4.1.3", diff --git a/packages/operators/src/index.js b/packages/operators/src/index.js index e69de29..88e67f7 100644 --- a/packages/operators/src/index.js +++ b/packages/operators/src/index.js @@ -0,0 +1,14 @@ +export { autoPagination } from './request/autoPagination'; +export { cache } from './request/cache'; +export { concurrentRequest } from './request/concurrentRequest'; +export { lazyPagination } from './request/lazyPagination'; +export { polling } from './request/polling'; +export { request, requestJSON, requestText, requestBlob } from './request/request'; +export { + resolve, + resolveJSON, + resolveText, + resolveBlob, + distinctUntilResponseChanged +} from './request/response'; +export { retryWhenError } from './request/retry'; diff --git a/packages/operators/src/request/autoPagination.test.js b/packages/operators/src/request/autoPagination.test.js index 6951218..1c16ef5 100644 --- a/packages/operators/src/request/autoPagination.test.js +++ b/packages/operators/src/request/autoPagination.test.js @@ -1,9 +1,9 @@ +import { mockAsync } from '#mocks/async'; +import { mockResponse } from '#mocks/response'; import { concatAll, delay, from, map, of } from 'rxjs'; import { TestScheduler } from 'rxjs/testing'; import { afterAll, beforeAll, beforeEach, describe, expect, test, vi } from 'vitest'; -import { mockAsync } from '../../../mock/async'; -import { mockResponse } from '../../../mock/response'; import { log, logResult } from '../log'; import { resolveJSON } from './response'; diff --git a/packages/operators/src/request/concurrentRequest.test.js b/packages/operators/src/request/concurrentRequest.test.js index 6d2548c..67e46ca 100644 --- a/packages/operators/src/request/concurrentRequest.test.js +++ b/packages/operators/src/request/concurrentRequest.test.js @@ -1,9 +1,9 @@ +import { mockAsync } from '#mocks/async'; +import { mockResponse } from '#mocks/response'; import { concatAll, delay, map, of } from 'rxjs'; import { TestScheduler } from 'rxjs/testing'; import { afterAll, beforeAll, beforeEach, describe, expect, test, vi } from 'vitest'; -import { mockAsync } from '../../../mock/async'; -import { mockResponse } from '../../../mock/response'; import { log, logResult } from '../log'; import { resolveJSON, resolveText } from './response'; diff --git a/packages/operators/src/request/lazyPagination.test.js b/packages/operators/src/request/lazyPagination.test.js index 3873271..1c32ced 100644 --- a/packages/operators/src/request/lazyPagination.test.js +++ b/packages/operators/src/request/lazyPagination.test.js @@ -1,9 +1,9 @@ +import { mockAsync } from '#mocks/async'; +import { mockResponse } from '#mocks/response'; import { concatAll, delay, map, of, Subject, tap } from 'rxjs'; import { TestScheduler } from 'rxjs/testing'; import { afterAll, beforeAll, beforeEach, describe, expect, test, vi } from 'vitest'; -import { mockAsync } from '../../../mock/async'; -import { mockResponse } from '../../../mock/response'; import { log, logResult } from '../log'; import { resolveJSON } from './response'; diff --git a/packages/operators/src/request/polling.test.js b/packages/operators/src/request/polling.test.js index 49f3842..e1bc614 100644 --- a/packages/operators/src/request/polling.test.js +++ b/packages/operators/src/request/polling.test.js @@ -1,10 +1,9 @@ +import { mockAsync } from '#mocks/async'; +import { mockResponse } from '#mocks/response'; import { concatMap } from 'rxjs'; import { TestScheduler } from 'rxjs/testing'; import { afterAll, beforeAll, beforeEach, describe, expect, test, vi } from 'vitest'; -import { mockAsync } from '../../../mock/async'; -import { mockResponse } from '../../../mock/response'; - describe('polling', () => { let testScheduler; diff --git a/packages/operators/src/request/request.test.js b/packages/operators/src/request/request.test.js index a9d6ec3..13f16c6 100644 --- a/packages/operators/src/request/request.test.js +++ b/packages/operators/src/request/request.test.js @@ -1,10 +1,10 @@ +import { mockAsync } from '#mocks/async.js'; +import { mockResponse } from '#mocks/response.js'; import { readFile } from 'node:fs/promises'; import { of } from 'rxjs'; import { TestScheduler } from 'rxjs/testing'; import { test, describe, beforeEach, expect, vi, afterAll, beforeAll } from 'vitest'; -import { mockAsync } from '../../../mock/async.js'; -import { mockResponse } from '../../../mock/response.js'; import { log, logResult } from '../log.js'; import { resolveJSON } from './response.js'; diff --git a/packages/operators/src/request/response.test.js b/packages/operators/src/request/response.test.js index d5e1ffb..a825c9f 100644 --- a/packages/operators/src/request/response.test.js +++ b/packages/operators/src/request/response.test.js @@ -1,8 +1,8 @@ +import { mockResponse } from '#mocks/response'; import { concatMap } from 'rxjs'; import { TestScheduler } from 'rxjs/testing'; import { afterEach, test, describe, beforeEach, expect, vi, beforeAll } from 'vitest'; -import { mockResponse } from '../../../mock/response'; import { log } from '../log'; import { distinctUntilResponseChanged, resolveJSON, resolveText } from './response'; diff --git a/packages/operators/src/request/retry.js b/packages/operators/src/request/retry.js index a5479f8..d1d459e 100644 --- a/packages/operators/src/request/retry.js +++ b/packages/operators/src/request/retry.js @@ -1,3 +1,4 @@ +import { connectionObservable } from '#observables/dom/window.js'; import { combineLatest, concatMap, @@ -12,8 +13,6 @@ import { throwError } from 'rxjs'; -import { connectionObservable } from '../../../observables/src/dom/window.js'; - const defaultTimeout = count => Math.min(60000, Math.pow(count, 2) * 1000); export const retryWhenError = ({ timeout = defaultTimeout, count } = {}) => {