Skip to content
This repository has been archived by the owner on Dec 10, 2024. It is now read-only.

Commit

Permalink
Add backend tests
Browse files Browse the repository at this point in the history
  • Loading branch information
james-pre committed Oct 31, 2024
1 parent 7ee1580 commit f3a9ba7
Show file tree
Hide file tree
Showing 7 changed files with 72 additions and 21 deletions.
34 changes: 30 additions & 4 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
14 changes: 7 additions & 7 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -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
29 changes: 21 additions & 8 deletions package-lock.json

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

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
},
"files": [
"dist",
"src",
"license.md",
"tsconfig.json"
],
Expand Down Expand Up @@ -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"
Expand Down
Binary file added tests/core.iso
Binary file not shown.
1 change: 1 addition & 0 deletions tests/iso.test.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
12 changes: 12 additions & 0 deletions tests/setup.ts
Original file line number Diff line number Diff line change
@@ -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' }),
});

0 comments on commit f3a9ba7

Please sign in to comment.