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

chore: updating tests for node 20 compatibility #782

Merged
merged 30 commits into from
Nov 13, 2023
Merged
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
a2c44f9
chore: updating tests for node 20 compatibility
krpeacock Oct 17, 2023
f0a24f3
updating root ts-jest
krpeacock Oct 17, 2023
c354374
chore: updating dependencies, separating e2e workspaces
krpeacock Oct 17, 2023
286ec0e
locking node versions
krpeacock Oct 17, 2023
af31a21
removing package-lock
krpeacock Oct 17, 2023
9e832fe
install latest version of npm
krpeacock Oct 17, 2023
8e21e51
removing node 16
krpeacock Oct 17, 2023
d262a8a
generating package-lock with node 16
krpeacock Oct 17, 2023
a2b4215
chore: updating tests for node 20 compatibility
krpeacock Oct 17, 2023
0913234
updating root ts-jest
krpeacock Oct 17, 2023
9358c18
chore: updating dependencies, separating e2e workspaces
krpeacock Oct 17, 2023
c2cb6f4
locking node versions
krpeacock Oct 17, 2023
c6d8b75
removing package-lock
krpeacock Oct 17, 2023
5955f3c
install latest version of npm
krpeacock Oct 17, 2023
bbe8145
removing node 16
krpeacock Oct 17, 2023
a3e75ba
generating package-lock with node 16
krpeacock Oct 17, 2023
c96435e
Merge branch 'kyle/node-20' of github.com:dfinity/agent-js into kyle/…
krpeacock Nov 6, 2023
379fa12
fixing merge
krpeacock Nov 6, 2023
343652a
updating types for bls-verify
krpeacock Nov 6, 2023
1a364da
moving inline snapshots to snapshot files
krpeacock Nov 6, 2023
35d64ff
Merge branch 'main' into kyle/node-20
krpeacock Nov 8, 2023
d0f388e
removes tslint in favor of eslint
krpeacock Nov 8, 2023
c485962
updating snapshots
krpeacock Nov 8, 2023
7842154
eslint-prettier
krpeacock Nov 8, 2023
60075c9
npm ci
krpeacock Nov 8, 2023
4abb7d9
eslint rules
krpeacock Nov 8, 2023
8c9edb0
request id eslint
krpeacock Nov 8, 2023
a580c4c
changelog
krpeacock Nov 8, 2023
b9aae63
Merge branch 'main' into kyle/node-20
krpeacock Nov 13, 2023
4287720
Update index.test.ts.snap
krpeacock Nov 13, 2023
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
Prev Previous commit
Next Next commit
eslint rules
  • Loading branch information
krpeacock committed Nov 8, 2023
commit 4abb7d9cc4d2b6e2e67dd2d7722ac18232bd12aa
4 changes: 2 additions & 2 deletions packages/auth-client/src/db.ts
Original file line number Diff line number Diff line change
@@ -63,9 +63,9 @@ export class IdbKeyVal {
*
* @param {DBCreateOptions} options {@link DbCreateOptions}
* @param {DBCreateOptions['dbName']} options.dbName name for the indexeddb database
* @default 'auth-client-db'
* @default
* @param {DBCreateOptions['storeName']} options.storeName name for the indexeddb Data Store
* @default 'ic-keyval'
* @default
* @param {DBCreateOptions['version']} options.version version of the database. Increment to safely upgrade
* @constructs an {@link IdbKeyVal}
*/
8 changes: 4 additions & 4 deletions packages/auth-client/src/idleManager.test.ts
Original file line number Diff line number Diff line change
@@ -52,7 +52,7 @@ describe('IdleManager tests', () => {
});
it('should delay its callback on keyboard events', () => {
const cb = jest.fn();
const manager = IdleManager.create({ onIdle: cb });
IdleManager.create({ onIdle: cb });
expect(cb).not.toHaveBeenCalled();
// simulate user being inactive for 9 minutes
jest.advanceTimersByTime(9 * 60 * 1000);
@@ -68,7 +68,7 @@ describe('IdleManager tests', () => {
});
it('should delay its callback on mouse events', () => {
const cb = jest.fn();
const manager = IdleManager.create({ onIdle: cb });
IdleManager.create({ onIdle: cb });
expect(cb).not.toHaveBeenCalled();
// simulate user being inactive for 9 minutes
jest.advanceTimersByTime(9 * 60 * 1000);
@@ -86,7 +86,7 @@ describe('IdleManager tests', () => {

it('should delay its callback on touch events', () => {
const cb = jest.fn();
const manager = IdleManager.create({ onIdle: cb });
IdleManager.create({ onIdle: cb });
expect(cb).not.toHaveBeenCalled();
// simulate user being inactive for 9 minutes
jest.advanceTimersByTime(9 * 60 * 1000);
@@ -106,7 +106,7 @@ describe('IdleManager tests', () => {

const scrollDebounce = 100;

const manager = IdleManager.create({ onIdle: cb, captureScroll: true, scrollDebounce });
IdleManager.create({ onIdle: cb, captureScroll: true, scrollDebounce });
expect(cb).not.toHaveBeenCalled();
// simulate user being inactive for 9 minutes
jest.advanceTimersByTime(9 * 60 * 1000);
7 changes: 4 additions & 3 deletions packages/auth-client/src/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import 'fake-indexeddb/auto';
import { Actor, HttpAgent } from '@dfinity/agent';
import { AgentError } from '@dfinity/agent/lib/cjs/errors';
@@ -308,7 +309,7 @@ describe('Auth Client', () => {
};

// setup auth client
const test = await AuthClient.create({
await AuthClient.create({
identity,
idleOptions: {
idleTimeout: 1000,
@@ -374,7 +375,7 @@ describe('Auth Client', () => {
set: jest.fn(),
};

const test = await AuthClient.create({
await AuthClient.create({
storage,
idleOptions: {
idleTimeout: 1000,
@@ -741,7 +742,7 @@ describe('Migration from Ed25519Key', () => {
fakeStore[x] = y;
}),
};
const client = await AuthClient.create({ storage });
await AuthClient.create({ storage });

// It should have stored a cryptoKey
expect(Object.keys(fakeStore[KEY_STORAGE_KEY])).toMatchInlineSnapshot(`
1 change: 1 addition & 0 deletions packages/bls-verify/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import { CTX } from 'amcl-js';
import { toHex } from './utils';

1 change: 1 addition & 0 deletions packages/candid/src/candid-core.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-unused-vars */
/* eslint-disable @typescript-eslint/no-this-alias */
/* eslint-disable @typescript-eslint/no-explicit-any */
import * as IDL from './idl';
2 changes: 2 additions & 0 deletions packages/candid/src/candid-ui.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
/* eslint-disable @typescript-eslint/no-unused-vars */
import * as IDL from './idl';
import { Principal } from '@dfinity/principal';
import * as UI from './candid-core';
2 changes: 2 additions & 0 deletions packages/candid/src/idl.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
/* eslint-disable @typescript-eslint/no-unused-vars */
/* eslint-disable @typescript-eslint/no-explicit-any */
/**
* @jest-environment node

Check warning on line 4 in packages/candid/src/idl.test.ts

GitHub Actions / test (8.8.4, release-0.16, 20)

Invalid JSDoc tag name "jest-environment"
*/
import * as IDL from './idl';
import { Principal } from '@dfinity/principal';
8 changes: 5 additions & 3 deletions packages/candid/src/idl.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* eslint-disable @typescript-eslint/no-unused-vars */
/* eslint-disable @typescript-eslint/no-explicit-any */
import { Principal as PrincipalId } from '@dfinity/principal';
import { JsonValue } from './types';
import { concat, PipeArrayBuffer as Pipe } from './utils/buffer';
@@ -225,6 +227,7 @@
}
return t;
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
public _buildTypeTableImpl(typeTable: TypeTable): void {
// No type table encoding for Primitive types.
return;
@@ -739,7 +742,6 @@
*
* Arrays of fixed-sized nat/int type (e.g. nat8), are encoded from and decoded to TypedArrays (e.g. Uint8Array).
* Arrays of float or other non-primitive types are encoded/decoded as untyped array in Javascript.
*
* @param {Type} t
*/
export class VecClass<T> extends ConstructType<T[]> {
@@ -945,7 +947,7 @@

/**
* Represents an IDL Record
* @param {Object} [fields] - mapping of function name to Type
* @param {object} [fields] - mapping of function name to Type
*/
export class RecordClass extends ConstructType<Record<string, any>> {
protected readonly _fields: Array<[string, Type]>;
@@ -1154,7 +1156,7 @@

/**
* Represents an IDL Variant
* @param {Object} [fields] - mapping of function name to Type
* @param {object} [fields] - mapping of function name to Type
*/
export class VariantClass extends ConstructType<Record<string, any>> {
private readonly _fields: Array<[string, Type]>;
@@ -1530,8 +1532,8 @@

/**
*
* @param x

Check warning on line 1535 in packages/candid/src/idl.ts

GitHub Actions / test (8.8.4, release-0.16, 20)

Missing JSDoc @param "x" description
* @returns {string}

Check warning on line 1536 in packages/candid/src/idl.ts

GitHub Actions / test (8.8.4, release-0.16, 20)

Missing JSDoc @returns description
*/
function toReadableString(x: unknown): string {
const str = JSON.stringify(x, (_key, value) =>
@@ -1545,9 +1547,9 @@

/**
* Encode a array of values
* @param argTypes

Check warning on line 1550 in packages/candid/src/idl.ts

GitHub Actions / test (8.8.4, release-0.16, 20)

Missing JSDoc @param "argTypes" description
* @param args

Check warning on line 1551 in packages/candid/src/idl.ts

GitHub Actions / test (8.8.4, release-0.16, 20)

Missing JSDoc @param "args" description
* @returns {Buffer} serialised value

Check warning on line 1552 in packages/candid/src/idl.ts

GitHub Actions / test (8.8.4, release-0.16, 20)

The type 'Buffer' is undefined
*/
export function encode(argTypes: Array<Type<any>>, args: any[]): ArrayBuffer {
if (args.length < argTypes.length) {
2 changes: 0 additions & 2 deletions packages/candid/src/utils/bigint-math.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/**
* Equivalent to `Math.log2(n)` with support for `BigInt` values
*
* @param n bigint or integer
* @returns integer
*/
@@ -15,7 +14,6 @@ export function ilog2(n: bigint | number): number {
/**
* Equivalent to `2 ** n` with support for `BigInt` values
* (necessary for browser preprocessors which replace the `**` operator with `Math.pow`)
*
* @param n bigint or integer
* @returns bigint
*/
1 change: 0 additions & 1 deletion packages/identity/src/identity/delegation.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { SignIdentity } from '@dfinity/agent';
import { Principal } from '@dfinity/principal';
import { DelegationChain, DelegationIdentity } from './delegation';
import { Ed25519KeyIdentity } from './ed25519';
6 changes: 0 additions & 6 deletions packages/identity/src/identity/delegation.ts
Original file line number Diff line number Diff line change
@@ -86,7 +86,6 @@ export interface SignedDelegation {

/**
* Sign a single delegation object for a period of time.
*
* @param from The identity that lends its delegation.
* @param to The identity that receives the delegation.
* @param expiration An expiration date for this delegation.
@@ -144,7 +143,6 @@ export class DelegationChain {
*
* To build a chain of more than 2 identities, this function needs to be called multiple times,
* passing the previous delegation chain into the options argument. For example:
*
* @example
* const rootKey = createKey();
* const middleKey = createKey();
@@ -159,7 +157,6 @@ export class DelegationChain {
*
* // We can now use a delegation identity that uses the delegation above:
* const identity = DelegationIdentity.fromDelegation(bottomKey, middleToBottom);
*
* @param from The identity that will delegate.
* @param to The identity that gets delegated. It can now sign messages as if it was the
* identity above.
@@ -187,7 +184,6 @@ export class DelegationChain {

/**
* Creates a DelegationChain object from a JSON string.
*
* @param json The JSON string to parse.
*/
public static fromJSON(json: string | JsonnableDelegationChain): DelegationChain {
@@ -224,7 +220,6 @@ export class DelegationChain {

/**
* Creates a DelegationChain object from a list of delegations and a DER-encoded public key.
*
* @param delegations The list of delegations.
* @param publicKey The DER-encoded public key of the key-pair signing the first delegation.
*/
@@ -270,7 +265,6 @@ export class DelegationChain {
export class DelegationIdentity extends SignIdentity {
/**
* Create a delegation without having access to delegateKey.
*
* @param key The key used to sign the reqyests.
* @param delegation A delegation object created using `createDelegation`.
*/
2 changes: 0 additions & 2 deletions packages/identity/src/identity/webauthn.ts
Original file line number Diff line number Diff line change
@@ -30,7 +30,6 @@ type PublicKeyCredentialWithAttachment = PublicKeyCredential & {
* the array and converting them into usable objects.
*
* See https://webauthn.guide/#registration (subsection "Example: Parsing the authenticator data").
*
* @param authData The authData field of the attestation response.
* @returns The COSE key of the authData.
*/
@@ -65,7 +64,6 @@ export class CosePublicKey implements PublicKey {
* because we don't need to verify the authenticity of the key on the server (we don't
* register our keys with the IC). Any challenge would do, even one per key, randomly
* generated.
*
* @param challenge The challenge to transform into a byte array. By default a hard
* coded string.
*/
Loading