From 0af6f5b93265c705bd4fa9925e568a0ee8488eb1 Mon Sep 17 00:00:00 2001 From: brekk Date: Tue, 23 Jan 2024 09:20:12 -0800 Subject: [PATCH] wire to the portal --- packages/cabal/autotests/cabal.spec.js | 14 ++++++++++++++ packages/cabal/cabal.js | 13 +++++++++++++ packages/cabal/package.json | 1 + yarn.lock | 16 ++++++++++++++++ 4 files changed, 44 insertions(+) create mode 100644 packages/cabal/autotests/cabal.spec.js diff --git a/packages/cabal/autotests/cabal.spec.js b/packages/cabal/autotests/cabal.spec.js new file mode 100644 index 0000000..5c48460 --- /dev/null +++ b/packages/cabal/autotests/cabal.spec.js @@ -0,0 +1,14 @@ +// This test automatically generated by doctor-general. +// Sourced from 'cabal.js', edits to this file may be erased. +import { + hasOrAdd +} from '../cabal' + +test('hasOrAdd', () => { + const s = new Set() + const key = Math.floor(Math.random() * 1e3) + s.add(key) + const hooked = hasOrAdd(s) + expect(hooked(key)).toBeTruthy() + expect(hooked('nice')).toBeFalsy() +}) diff --git a/packages/cabal/cabal.js b/packages/cabal/cabal.js index b05ea60..e5e0674 100644 --- a/packages/cabal/cabal.js +++ b/packages/cabal/cabal.js @@ -1,5 +1,18 @@ import { curry } from 'ramda' +/** + * @name hasOrAdd + * @exported + * @example + * ```js test=true + * const s = new Set() + * const key = Math.floor(Math.random() * 1e3) + * s.add(key) + * const hooked = hasOrAdd(s) + * expect(hooked(key)).toBeTruthy() + * expect(hooked('nice')).toBeFalsy() + * ``` + */ export const hasOrAdd = curry(function _hasOrAdd(set, x) { const had = set.has(x) if (!had) { diff --git a/packages/cabal/package.json b/packages/cabal/package.json index 12909d8..25e5ae4 100644 --- a/packages/cabal/package.json +++ b/packages/cabal/package.json @@ -18,6 +18,7 @@ }, "devDependencies": { "@testing-library/jest-dom": "6.1.5", + "doctor-general-cli": "portal:../../tools/doctor-general-cli", "dotenv-cli": "7.3.0", "eslint-config-monoculture": "workspace:shared/eslint-config-monoculture", "jest": "29.7.0", diff --git a/yarn.lock b/yarn.lock index 5702661..74a1b52 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5276,6 +5276,7 @@ __metadata: resolution: "cabal@workspace:packages/cabal" dependencies: "@testing-library/jest-dom": "npm:6.1.5" + doctor-general-cli: "portal:../../tools/doctor-general-cli" dotenv-cli: "npm:7.3.0" envtrace: "npm:0.0.2" eslint-config-monoculture: "workspace:shared/eslint-config-monoculture" @@ -7320,6 +7321,21 @@ __metadata: languageName: unknown linkType: soft +"doctor-general-cli@portal:../../tools/doctor-general-cli::locator=cabal%40workspace%3Apackages%2Fcabal": + version: 0.0.0-use.local + resolution: "doctor-general-cli@portal:../../tools/doctor-general-cli::locator=cabal%40workspace%3Apackages%2Fcabal" + dependencies: + climate: "workspace:packages/climate" + doctor-general: "workspace:packages/doctor-general" + inherent: "workspace:packages/inherent" + kiddo: "workspace:packages/kiddo" + ramda: "npm:0.29.1" + bin: + doctor-general: ./dist/doctor-general.cjs + drgen: ./dist/doctor-general.cjs + languageName: node + linkType: soft + "doctor-general-cli@portal:../../tools/doctor-general-cli::locator=inherent%40workspace%3Apackages%2Finherent": version: 0.0.0-use.local resolution: "doctor-general-cli@portal:../../tools/doctor-general-cli::locator=inherent%40workspace%3Apackages%2Finherent"