From f3a9ba7b27d7a79a0c3019868608530397db79f6 Mon Sep 17 00:00:00 2001 From: James Prevett Date: Wed, 30 Oct 2024 19:30:43 -0500 Subject: [PATCH] Add backend tests --- .github/workflows/ci.yaml | 34 +++++++++++++++++++++++++++++---- .github/workflows/release.yaml | 14 +++++++------- package-lock.json | 29 ++++++++++++++++++++-------- package.json | 3 +-- tests/core.iso | Bin 0 -> 397312 bytes tests/iso.test.ts | 1 + tests/setup.ts | 12 ++++++++++++ 7 files changed, 72 insertions(+), 21 deletions(-) create mode 100644 tests/core.iso create mode 100644 tests/setup.ts diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 94dd28f..41e5daf 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -11,7 +11,33 @@ on: jobs: ci: name: CI - uses: zen-fs/core/.github/workflows/ci.yaml@main - permissions: - contents: read - id-token: write + runs-on: ubuntu-latest + defaults: + run: + shell: bash + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: 22 + + - name: Install dependencies + run: npm install + + - name: Formatting + run: npm run format:check + + - name: Linting + run: npm run lint + + - name: Build + run: npm run build + + - name: Backend-only Tests + run: npm test + + - name: Unit tests (Iso) + run: npx zenfs-test tests/setup.ts diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 613f537..ed454a7 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -1,17 +1,17 @@ name: Release - on: release: types: [created] - jobs: ci: name: CI - uses: zen-fs/core/.github/workflows/ci.yaml@main - permissions: - contents: read - id-token: write + uses: ./.github/workflows/ci.yaml + docs: + name: Docs + uses: zen-fs/core/.github/workflows/deploy-docs.yaml@main + needs: ci release: name: Release - uses: zen-fs/core/.github/workflows/release.yaml@main + uses: zen-fs/core/.github/workflows/release-common.yaml@main + needs: ci secrets: inherit diff --git a/package-lock.json b/package-lock.json index 738b52c..04f7b8c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -31,7 +31,7 @@ "url": "https://github.com/sponsors/james-pre" }, "peerDependencies": { - "@zenfs/core": "^1.1.0" + "@zenfs/core": "^1.2.0" } }, "node_modules/@aashutoshrathi/word-wrap": { @@ -414,9 +414,10 @@ } }, "node_modules/@types/readable-stream": { - "version": "4.0.11", - "resolved": "https://registry.npmjs.org/@types/readable-stream/-/readable-stream-4.0.11.tgz", - "integrity": "sha512-R3eUMUTTKoIoaz7UpYLxvZCrOmCRPRbAmoDDHKcimTEySltaJhF8hLzj4+EzyDifiX5eK6oDQGSfmNnXjxZzYQ==", + "version": "4.0.16", + "resolved": "https://registry.npmjs.org/@types/readable-stream/-/readable-stream-4.0.16.tgz", + "integrity": "sha512-Fvp+8OcU8PyV90KTk5tR/rI8OjD3MP5NUow5rjOsZo+9zxf4p4soJtK9j4V6yeG30TH6rZxqRaP4JLa8lNNTNQ==", + "license": "MIT", "peer": true, "dependencies": { "@types/node": "*", @@ -634,9 +635,9 @@ "optional": true }, "node_modules/@zenfs/core": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/@zenfs/core/-/core-1.1.4.tgz", - "integrity": "sha512-v1dKsdhTgRo0hZ9yXDPhLWA0VxtA4YLMnVSu1NVD2u18kMUbnEErEgNz4FLP+nIDmzucNjQPO8hsIHYnzPnQIw==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@zenfs/core/-/core-1.2.1.tgz", + "integrity": "sha512-gtjU1UXXK4nxEAafbaf43l/Ho3St+NVNpNShIyYMAbkWhD+piHwnBHo550b5gFD36m8RjmFzSqQw0VDGGd1cdg==", "license": "MIT", "peer": true, "dependencies": { @@ -649,7 +650,8 @@ "utilium": "^1.0.0" }, "bin": { - "make-index": "scripts/make-index.js" + "make-index": "scripts/make-index.js", + "zenfs-test": "scripts/test.js" }, "engines": { "node": ">= 16" @@ -663,6 +665,7 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz", "integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==", + "license": "MIT", "peer": true, "dependencies": { "event-target-shim": "^5.0.0" @@ -764,6 +767,7 @@ "url": "https://feross.org/support" } ], + "license": "MIT", "peer": true }, "node_modules/brace-expansion": { @@ -805,6 +809,7 @@ "url": "https://feross.org/support" } ], + "license": "MIT", "peer": true, "dependencies": { "base64-js": "^1.3.1", @@ -1198,6 +1203,7 @@ "version": "5.0.1", "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz", "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==", + "license": "MIT", "peer": true, "engines": { "node": ">=6" @@ -1213,6 +1219,7 @@ "version": "3.3.0", "resolved": "https://registry.npmjs.org/events/-/events-3.3.0.tgz", "integrity": "sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==", + "license": "MIT", "peer": true, "engines": { "node": ">=0.8.x" @@ -1476,6 +1483,7 @@ "url": "https://feross.org/support" } ], + "license": "BSD-3-Clause", "peer": true }, "node_modules/ignore": { @@ -1991,6 +1999,7 @@ "version": "0.11.10", "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", "integrity": "sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==", + "license": "MIT", "peer": true, "engines": { "node": ">= 0.6.0" @@ -2051,6 +2060,7 @@ "version": "4.5.2", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-4.5.2.tgz", "integrity": "sha512-yjavECdqeZ3GLXNgRXgeQEdz9fvDDkNKyHnbHRFtOr7/LcfgBcmct7t/ET+HaCTqfh06OzoAxrkN/IfjJBVe+g==", + "license": "MIT", "peer": true, "dependencies": { "abort-controller": "^3.0.0", @@ -2127,6 +2137,7 @@ "version": "5.1.2", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "license": "MIT", "peer": true }, "node_modules/semver": { @@ -2193,6 +2204,7 @@ "version": "1.3.0", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "license": "MIT", "peer": true, "dependencies": { "safe-buffer": "~5.2.0" @@ -2216,6 +2228,7 @@ "url": "https://feross.org/support" } ], + "license": "MIT", "peer": true }, "node_modules/stringify-entities": { diff --git a/package.json b/package.json index 3611df6..a755e5f 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,6 @@ }, "files": [ "dist", - "src", "license.md", "tsconfig.json" ], @@ -59,7 +58,7 @@ "typescript-eslint": "^8.8.0" }, "peerDependencies": { - "@zenfs/core": "^1.1.0" + "@zenfs/core": "^1.2.0" }, "dependencies": { "utilium": "^1.0.0" diff --git a/tests/core.iso b/tests/core.iso new file mode 100644 index 0000000000000000000000000000000000000000..35967fb7774a27fdf4ee22eb841fb9ec57826b1f GIT binary patch literal 397312 zcmeI*-EJf2c>rK-ku;8q00r8@`2mU#d$QVurKGiM*D-v+rADiPu zgW_yCq}SUzK(8Se(VNIwFQv!1hxYr1)Y@yuG0?E-?NC*iAa z-J{{)^s5htTgm_0JlNjd?)~!pot>RK>7Sj~UfbE-9Nzt#&%*vLJ-oZ~`ex7TJFle& zukC!g`}cqSw|l?+i?lGU4{qP8z@x06j|TZ^=TR2ogYeEg;P9y?eN`xAW6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5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF z5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk z1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs z0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZ zfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&U zAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C7 z2oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N z0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+ z009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBly zK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF z5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk z1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs W0RjXF5FkK+009C72oU%`3;ZuG16mva literal 0 HcmV?d00001 diff --git a/tests/iso.test.ts b/tests/iso.test.ts index 7b3572c..fa210ce 100644 --- a/tests/iso.test.ts +++ b/tests/iso.test.ts @@ -1,3 +1,4 @@ +/* This test suite tests the functionality of exclusively the backend */ import { configureSingle, fs } from '@zenfs/core'; import { readFileSync } from 'fs'; import assert from 'node:assert'; diff --git a/tests/setup.ts b/tests/setup.ts new file mode 100644 index 0000000..cda22d4 --- /dev/null +++ b/tests/setup.ts @@ -0,0 +1,12 @@ +import { configureSingle, InMemory, Overlay } from '@zenfs/core'; +import { readFileSync } from 'node:fs'; +import { Iso } from '../src/IsoFS.js'; + +await configureSingle({ + backend: Overlay, + readable: Iso.create({ + data: readFileSync(import.meta.dirname + '/core.iso'), + name: 'core.iso', + }), + writable: InMemory.create({ name: 'tests' }), +});