Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🚚 Move tests around a bit #110

Merged
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -105,3 +105,6 @@ dist
# TernJS port file
.tern-port
/.idea/

# temporary folders
**/temp/
1 change: 0 additions & 1 deletion lib/.eslintrc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ env:
browser: true
rules:
"@typescript-eslint/ban-ts-comment": off
strict: off
extends:
- eslint:recommended
- plugin:@typescript-eslint/recommended
Expand Down
4 changes: 2 additions & 2 deletions lib/.mocharc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extension": ["ts"],
"spec": ["tdf3/test/**/*.spec.+(js|ts)"],
"require": "tdf3/test/babel-register.js"
"spec": ["tests/mocha/**/*.spec.+(js|ts)"],
"require": "tests/mocha/babel-register.js"
}
2 changes: 1 addition & 1 deletion lib/.nycrc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"tdf3/src/**/*.ts"
],
"exclude": [
"tdf3/test/**/*.spec.*"
"tests/mocha/**/*.spec.*"
],
"require": [
"ts-node/register"
Expand Down
6 changes: 3 additions & 3 deletions lib/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,13 @@
"build": "npm run clean && webpack && tsc -p tsconfig-esm.json && node prepareNodeESM.js && ../scripts/add-module-types.sh esm && ../scripts/fill-version.sh",
"clean": "rm -rf {build,dist}",
"doc": "typedoc --out dist/docs src/index.ts",
"format": "prettier --write \"{src,tdf3,test}/**/*.ts\"",
"format": "prettier --write \"{src,tdf3,tests}/**/*.ts\"",
"license-check": "license-checker --production --onlyAllow 'Apache-2.0; BSD; CC-BY-4.0; ISC; MIT'",
"lint": "eslint ./{src,test}/**/*.ts",
"lint": "eslint ./{src,tdf3,tests}/**/*.ts",
"prepack": "npm run build",
"test": "npm run clean && tsc -p tsconfig-esm.json && web-test-runner && npm run test:tdf3",
"test:watch": "web-test-runner --watch",
"test:tdf3": "c8 mocha --file tdf3/test/setup.js --require @babel/register --timeout 300000",
"test:tdf3": "c8 mocha --file tests/mocha/setup.js --require @babel/register --timeout 300000",
"watch": "(trap 'kill 0' SIGINT; npm run build && (npm run build:watch & npm run test -- --watch))"
},
"dependencies": {
Expand Down
12 changes: 0 additions & 12 deletions lib/tdf3/.gitignore

This file was deleted.

6 changes: 3 additions & 3 deletions lib/tdf3/src/crypto/crypto-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
* @param size in bits requested
* @param minSize in bits allowed
*/
export const isValidAsymmetricKeySize = (size: number | undefined, minSize: number): boolean => {
export const isValidAsymmetricKeySize = (size: number | undefined, minSize?: number): boolean => {
// No size specified is fine because the minSize will be used
if (size === undefined) {
return true;
return !!minSize;
}

if (typeof size !== 'number' || size < minSize) {
if (typeof size !== 'number' || (minSize && size < minSize)) {
return false;
}

Expand Down
5 changes: 3 additions & 2 deletions lib/tdf3/src/tdf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,10 @@ class TDF extends EventEmitter {
* @param {String} transferUrl
* @return {Buffer}
*/
static wrapHtml(payload: Buffer, manifest: Manifest, transferUrl: string): Buffer {
static wrapHtml(payload: Buffer, manifest: Manifest | string, transferUrl: string): Buffer {
const { origin } = new URL(transferUrl);
const exportManifest: string = JSON.stringify(manifest);
const exportManifest: string =
typeof manifest === 'string' ? manifest : JSON.stringify(manifest);

const fullHtmlString = htmlWrapperTemplate({
transferUrl,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ export async function* getDataReadableStream(data: ReadableStream): AsyncGenerat
// Else yield the chunk.
yield Buffer.from(value);
}
} catch (e) {
throw e;
} finally {
// release the lock for reading from this stream.
reader.releaseLock();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
* @internal
*/
export const ClientSharedValues = {
// eslint-disable-next-line @typescript-eslint/no-empty-function
lstatSync: () => {},
};
12 changes: 0 additions & 12 deletions lib/tdf3/test/__fixtures__/hs256.json

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.
24 changes: 0 additions & 24 deletions lib/tdf3/test/unit/mock-stream.spec.js

This file was deleted.

10 changes: 0 additions & 10 deletions lib/test/nanotdf/browser-tests/client.test-browser.js

This file was deleted.

88 changes: 0 additions & 88 deletions lib/test/nanotdf/browser-tests/fixtures.js

This file was deleted.

34 changes: 0 additions & 34 deletions lib/test/nanotdf/browser-tests/helpers.js

This file was deleted.

47 changes: 0 additions & 47 deletions lib/test/nanotdf/browser-tests/index.html

This file was deleted.

Loading