Skip to content

Commit

Permalink
Add some test
Browse files Browse the repository at this point in the history
  • Loading branch information
zjkmxy committed Jan 25, 2024
1 parent b9b50ea commit 8a83f21
Show file tree
Hide file tree
Showing 22 changed files with 928 additions and 43 deletions.
17 changes: 17 additions & 0 deletions deno.lock

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

11 changes: 8 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "1.0.8",
"description": "NDNts Auxiliary Package for Web and Deno",
"scripts": {
"test": "deno test",
"test": "deno test --no-check",
"format": "deno fmt",
"lint": "deno lint",
"build": "deno run -A ./build.ts"
Expand All @@ -22,13 +22,13 @@
"eventemitter3": "^5.0.1",
"jose": "^5.2.0",
"tslib": "^2.6.2",
"uuid": "^9.0.1",
"yjs": "^13.6.11"
},
"devDependencies": {
"@ndn/endpoint": "https://ndnts-nightly.ndn.today/endpoint.tgz",
"@ndn/fw": "https://ndnts-nightly.ndn.today/fw.tgz",
"@ndn/keychain": "https://ndnts-nightly.ndn.today/keychain.tgz",
"@ndn/l3face": "https://ndnts-nightly.ndn.today/l3face.tgz",
"@ndn/naming-convention2": "https://ndnts-nightly.ndn.today/naming-convention2.tgz",
"@ndn/ndncert": "https://ndnts-nightly.ndn.today/ndncert.tgz",
"@ndn/ndnsec": "https://ndnts-nightly.ndn.today/ndnsec.tgz",
Expand All @@ -40,12 +40,17 @@
"@ndn/tlv": "https://ndnts-nightly.ndn.today/tlv.tgz",
"@ndn/util": "https://ndnts-nightly.ndn.today/util.tgz",
"@ndn/ws-transport": "https://ndnts-nightly.ndn.today/ws-transport.tgz",
"@types/wicg-file-system-access": "^2023.10.4"
"@types/wicg-file-system-access": "^2023.10.4",
"abortable-iterator": "^5.0.1",
"it-pushable": "^3.2.3",
"p-defer": "^4.0.0",
"streaming-iterables": "^8.0.1"
},
"peerDependencies": {
"@ndn/endpoint": ">=0.0.0",
"@ndn/fw": ">=0.0.0",
"@ndn/keychain": ">=0.0.0",
"@ndn/l3face": ">=0.0.0",
"@ndn/naming-convention2": ">=0.0.0",
"@ndn/ndncert": ">=0.0.0",
"@ndn/ndnsec": ">=0.0.0",
Expand Down
47 changes: 27 additions & 20 deletions pnpm-lock.yaml

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

1 change: 1 addition & 0 deletions src/dep.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
* This module re-exports the required dependecies, as BYONM does not work with the import map.
*/
export * as assert from 'https://deno.land/[email protected]/assert/mod.ts';
export * as hex from 'https://deno.land/[email protected]/encoding/hex.ts';
3 changes: 3 additions & 0 deletions src/namespace/name-pattern.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const pattern = ([_value]: TemplateStringsArray) => {
throw new Error('Not implemented');
};
7 changes: 5 additions & 2 deletions src/storage/deno-kv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,11 @@ export class DenoKvStorage implements Storage {
}
}

close(): Promise<void> {
close() {
this.kv.close();
return Promise.resolve();
}

[Symbol.dispose]() {
this.close();
}
}
6 changes: 5 additions & 1 deletion src/storage/file-system.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,9 @@ export class FsStorage implements Storage {
}
}

async close(): Promise<void> {}
close() {}

[Symbol.dispose]() {
this.close();
}
}
6 changes: 5 additions & 1 deletion src/storage/in-memory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,9 @@ export class InMemoryStorage implements Storage {
this.cache = {};
}

async close() {}
close() {}

[Symbol.dispose]() {
this.close();
}
}
4 changes: 2 additions & 2 deletions src/storage/types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SA: https://github.com/azu/kvs/blob/master/packages/types/src/index.ts
export interface Storage {
export interface Storage extends Disposable {
/**
* Look up the value associated to the key.
* @param key The key to look up
Expand Down Expand Up @@ -37,5 +37,5 @@ export interface Storage {
/**
* Close the connection
*/
close(): Promise<void>;
close(): void;
}
Loading

0 comments on commit 8a83f21

Please sign in to comment.