https://github.com/statewalker/webrun-files-test
https://github.com/statewalker/webrun-files-test
Last synced: 10 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/statewalker/webrun-files-test
- Owner: statewalker
- License: mit
- Created: 2023-03-10T21:53:27.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2024-04-05T05:13:59.000Z (about 2 years ago)
- Last Synced: 2025-01-16T02:21:46.403Z (over 1 year ago)
- Language: JavaScript
- Size: 3.91 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# @statewalker/webrun-files-tests
This package contains a set of common tests for all FilesApi (@statewalker/webrun-files) implementations.
## Usage
```js
// Import a batch of common tests
import { runFilesApiTests } from "@statewalker/webrun-files-tests";
// Import a specific FilesApi implementation
import { MemFilesApi } from "@statewalker/webrun-files";
// Import expect.js
import expect from "expect.js";s
// Import crypto library (used to calculate content hashes - SHA1).
import crypto from "crypto";
// Run tests on the specified FilesApi instance. This method provids all required dependencies.
runFilesApiTests({
// Human-readable name of this set of tests:
name : "MemFilesApi",
// This method returns a FilesApi instance to test:
newFilesApi : () => new MemFilesApi(),
// An instance of the "expect.js" testing library:
expect,
// Standard crypto instance. Used to calculate SHA-1 hashes of files content:
crypto
})
```