Skip to content

Commit

Permalink
Merge branch 'development' into rayback_240207_add-quality-checks-to-…
Browse files Browse the repository at this point in the history
…pr-process
  • Loading branch information
jrayback authored Feb 29, 2024
2 parents e5723f2 + 2cd7800 commit bd1b8e1
Show file tree
Hide file tree
Showing 23 changed files with 128 additions and 2,703 deletions.
2 changes: 1 addition & 1 deletion adrs/003-convert-jest-tests-to-native-runner.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Status

Proposed
Implemented

## Context

Expand Down
5 changes: 0 additions & 5 deletions jest.config.js

This file was deleted.

2,724 changes: 60 additions & 2,664 deletions package-lock.json

Large diffs are not rendered by default.

5 changes: 1 addition & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "1.0.0",
"description": "Implement TypeScript-native CESR primitives.",
"main": "index.js",
"scripts": {
"scripts": {
"start": "ts-node index.ts",
"test": "jest",
"formatting": "prettier . --check",
Expand All @@ -28,17 +28,14 @@
},
"homepage": "https://github.com/WebOfTrust/cesr-ts#readme",
"devDependencies": {
"@types/jest": "^29.5.8",
"@types/libsodium-wrappers-sumo": "^0.7.8",
"@types/node": "^20.9.0",
"@typescript-eslint/eslint-plugin": "^6.13.1",
"@typescript-eslint/parser": "^6.13.1",
"depcheck": "^1.4.7",
"eslint": "^8.54.0",
"eslint-config-prettier": "^9.0.0",
"jest": "^29.7.0",
"prettier": "3.1.0",
"ts-jest": "^29.1.1",
"ts-node": "^10.9.1",
"typescript": "^5.2.2"
},
Expand Down
4 changes: 3 additions & 1 deletion test/bexter.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { strict as assert } from 'assert';
import { describe, it } from 'node:test';
import assert from 'node:assert/strict';

import { Bexter } from '../src/bexter';
import { b } from '../src/core';
import { MtrDex } from '../src/matter';
Expand Down
4 changes: 3 additions & 1 deletion test/coring.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { describe, it } from 'node:test';
import assert from 'node:assert/strict';

import libsodium from 'libsodium-wrappers-sumo';
import { b, d, b64ToInt, intToB64, intToB64b } from '../src/core';
import { strict as assert } from 'assert';
import { bytesToInt, intToBytes } from '../src/utils';

describe('int to b64 and back', () => {
Expand Down
4 changes: 3 additions & 1 deletion test/counter.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { describe, it } from 'node:test';
import assert from 'node:assert/strict';

import { Counter, CtrDex } from '../src/counter';
import { strict as assert } from 'assert';
import { b, b64ToInt, intToB64 } from '../src/core';

describe('int to b64 and back', () => {
Expand Down
4 changes: 3 additions & 1 deletion test/decrypter.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { describe, it } from 'node:test';
import assert from 'node:assert/strict';

import libsodium from 'libsodium-wrappers-sumo';
import { Signer } from '../src/signer';
import { Matter, MtrDex } from '../src/matter';
import { strict as assert } from 'assert';
import { Salter } from '../src/salter';
import { Decrypter } from '../src/decrypter';
import { Encrypter } from '../src/encrypter';
Expand Down
6 changes: 3 additions & 3 deletions test/diger.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Matter } from '../src/matter';
import { describe, it } from 'node:test';
import assert from 'node:assert/strict';

import { Matter } from '../src/matter';
import { blake3 } from '@noble/hashes/blake3';
import { strict as assert } from 'assert';

import { Diger } from '../src/diger';
import { MtrDex } from '../src/matter';
import { Buffer } from 'buffer';
Expand Down
5 changes: 3 additions & 2 deletions test/encrypter.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Matter } from '../src/matter';
import { describe, it } from 'node:test';
import assert from 'node:assert/strict';

import { strict as assert } from 'assert';
import { Matter } from '../src/matter';
import { MtrDex } from '../src/matter';
import libsodium from 'libsodium-wrappers-sumo';
import { Signer } from '../src/signer';
Expand Down
4 changes: 3 additions & 1 deletion test/indexer.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { describe, it } from 'node:test';
import assert from 'node:assert/strict';

import libsodium from 'libsodium-wrappers-sumo';
import { strict as assert } from 'assert';
import { IdrDex, Indexer } from '../src/indexer';
import { b, intToB64 } from '../src/core';
import { Buffer } from 'buffer';
Expand Down
3 changes: 2 additions & 1 deletion test/matter.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { strict as assert } from 'assert';
import { describe, it } from 'node:test';
import assert from 'node:assert/strict';

import { Sizage } from '../src/matter';

Expand Down
4 changes: 3 additions & 1 deletion test/number.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { strict as assert } from 'assert';
import { describe, it } from 'node:test';
import assert from 'node:assert/strict';

import { CesrNumber } from '../src/number';

describe('THolder', () => {
Expand Down
4 changes: 3 additions & 1 deletion test/pather.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { strict as assert } from 'assert';
import { describe, it } from 'node:test';
import assert from 'node:assert/strict';

import { Pather } from '../src/pather';
import { b } from '../src/core';

Expand Down
4 changes: 3 additions & 1 deletion test/prefixer.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { describe, it } from 'node:test';
import assert from 'node:assert/strict';

import libsodium from 'libsodium-wrappers-sumo';
import { Dict, Ident, Ilks, Serials, versify, Versionage } from '../src/core';
import { MtrDex } from '../src/matter';
import { Prefixer } from '../src/prefixer';
import { strict as assert } from 'assert';

describe('Prefixer', () => {
it('should create autonomic identifier prefix using derivation as determined by code from ked', async () => {
Expand Down
4 changes: 3 additions & 1 deletion test/saider.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { describe, it } from 'node:test';
import assert from 'node:assert/strict';

import { Dict, Ident, Serials, versify, Versionage } from '../src/core';
import { strict as assert } from 'assert';
import { MtrDex } from '../src/matter';
import libsodium from 'libsodium-wrappers-sumo';
import { Saider } from '../src/saider';
Expand Down
4 changes: 3 additions & 1 deletion test/salter.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { strict as assert } from 'assert';
import { describe, it } from 'node:test';
import assert from 'node:assert/strict';

import libsodium from 'libsodium-wrappers-sumo';

import { Salter } from '../src/salter';
Expand Down
4 changes: 3 additions & 1 deletion test/seqner.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { strict as assert } from 'assert';
import { describe, it } from 'node:test';
import assert from 'node:assert/strict';

import libsodium from 'libsodium-wrappers-sumo';

import { Seqner } from '../src/seqner';
Expand Down
4 changes: 3 additions & 1 deletion test/serder.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { describe, it } from 'node:test';
import assert from 'node:assert/strict';

import { deversify, Dict, Ilks, Serials, Version } from '../src/core';
import { strict as assert } from 'assert';
import { Salter, Tier } from '../src/salter';
import { MtrDex } from '../src/matter';
import { Diger } from '../src/diger';
Expand Down
4 changes: 3 additions & 1 deletion test/signer.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { strict as assert } from 'assert';
import { describe, it } from 'node:test';
import assert from 'node:assert/strict';

import libsodium from 'libsodium-wrappers-sumo';

import { Signer } from '../src/signer';
Expand Down
13 changes: 9 additions & 4 deletions test/utils.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import { describe, it } from 'node:test';
import assert from 'node:assert/strict';

import { Ident, Serials, d, versify } from '../src/core';
import { Saider } from '../src/saider';
import { Serder } from '../src/serder';
Expand All @@ -6,7 +9,7 @@ import {
serializeIssExnAttachment,
} from '../src/utils';

describe(serializeIssExnAttachment, () => {
describe('serializeIssExnAttachment', () => {
it('serializes iss data', () => {
const [saider, data] = Saider.saidify({
d: '',
Expand All @@ -15,13 +18,14 @@ describe(serializeIssExnAttachment, () => {

const result = serializeIssExnAttachment(new Serder(data), saider);

expect(d(result)).toEqual(
assert.equal(
d(result),
'-VAS-GAB0AAAAAAAAAAAAAAAAAAAAAAAEKZPmzJqhx76bcC2ftPQgeRirmOd8ZBOtGVqHJrSm7F1'
);
});
});

describe(serializeACDCAttachment, () => {
describe('serializeACDCAttachment', () => {
it('serializes acdc data', () => {
const [saider, data] = Saider.saidify({
d: '',
Expand All @@ -33,7 +37,8 @@ describe(serializeACDCAttachment, () => {

const result = serializeACDCAttachment(new Serder(data), saider);

expect(d(result)).toEqual(
assert.equal(
d(result),
'-IABBHsiZCI6IkVORTZzbWw4X1NMZVIzdk9NajRJRExLX2Nn0AAAAAAAAAAAAAAAAAAAAAAAENE6sml8_SLeR3vOMj4IDLK_cgd-A-vtg0Jnu7ozdBjW'
);
});
Expand Down
13 changes: 9 additions & 4 deletions test/verfer.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { describe, it } from 'node:test';
import assert from 'node:assert/strict';

import { MtrDex } from '../src/matter';
import libsodium from 'libsodium-wrappers-sumo';
import { strict as assert } from 'assert';
import { Verfer } from '../src/verfer';
import { p256 } from '@noble/curves/p256';
import { Buffer } from 'buffer';
Expand Down Expand Up @@ -71,8 +73,11 @@ describe('Verfer', () => {
187, 162, 251, 58, 206, 241, 203, 27, 76, 236, 37, 189, 148, 240,
178, 204, 133, 31,
]);
expect(function () {
new Verfer({ raw: publicKey, code: MtrDex.ECDSA_256k1 });
}).toThrow(new Error(`Unsupported code = 1AAB for verifier.`));
assert.throws(
function () {
new Verfer({ raw: publicKey, code: MtrDex.ECDSA_256k1 });
},
{ message: 'Unsupported code = 1AAB for verifier.' }
);
});
});
3 changes: 1 addition & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
// "typeRoots": [], /* Specify multiple folders that act like `./node_modules/@types`. */
"types": [
"node",
"jest"
"node"
] /* Specify type package names to be included without being referenced in a source file. */,
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
// "resolveJsonModule": true, /* Enable importing .json files */
Expand Down

0 comments on commit bd1b8e1

Please sign in to comment.