Skip to content

Commit

Permalink
tests: general fixes to tests.
Browse files Browse the repository at this point in the history
[ci skip]
  • Loading branch information
tegefaulkes committed Oct 9, 2023
1 parent c75f5da commit ef77d6b
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 22 deletions.
2 changes: 1 addition & 1 deletion src/keys/KeyRing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class KeyRing {
}: {
keysPath: string;
password: string;
options: Partial<KeyRingOptions>;
options?: Partial<KeyRingOptions>;
workerManager?: PolykeyWorkerManagerInterface;
fs?: FileSystem;
logger?: Logger;
Expand Down
14 changes: 9 additions & 5 deletions tests/discovery/Discovery.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,12 @@ describe('Discovery', () => {
keyRing = await KeyRing.createKeyRing({
password,
keysPath,
options: {
passwordOpsLimit: keysUtils.passwordOpsLimits.min,
passwordMemLimit: keysUtils.passwordMemLimits.min,
strictMemoryLock: false,
},
logger: logger.getChild('KeyRing'),
passwordOpsLimit: keysUtils.passwordOpsLimits.min,
passwordMemLimit: keysUtils.passwordMemLimits.min,
strictMemoryLock: false,
});
const dbPath = path.join(dataDir, 'db');
db = await DB.createDB({
Expand Down Expand Up @@ -156,8 +158,10 @@ describe('Discovery', () => {
keyRing,
nodeGraph,
tlsConfig,
connectionConnectTimeoutTime: 2000,
connectionIdleTimeoutTime: 2000,
options: {
connectionConnectTimeoutTime: 2000,
connectionIdleTimeoutTime: 2000,
},
logger: logger.getChild('NodeConnectionManager'),
});
nodeManager = new NodeManager({
Expand Down
10 changes: 6 additions & 4 deletions tests/keys/CertManager.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,13 @@ describe(CertManager.name, () => {
keyRing = await KeyRing.createKeyRing({
keysPath,
password,
privateKey,
options: {
privateKey,
passwordOpsLimit: keysUtils.passwordOpsLimits.min,
passwordMemLimit: keysUtils.passwordMemLimits.min,
strictMemoryLock: false,
},
logger,
passwordOpsLimit: keysUtils.passwordOpsLimits.min,
passwordMemLimit: keysUtils.passwordMemLimits.min,
strictMemoryLock: false,
});
dbPath = `${dataDir}/db`;
db = await DB.createDB({
Expand Down
8 changes: 5 additions & 3 deletions tests/notifications/NotificationsManager.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,12 @@ describe('NotificationsManager', () => {
keyRing = await KeyRing.createKeyRing({
password,
keysPath,
options: {
passwordOpsLimit: keysUtils.passwordOpsLimits.min,
passwordMemLimit: keysUtils.passwordMemLimits.min,
strictMemoryLock: false,
},
logger,
passwordOpsLimit: keysUtils.passwordOpsLimits.min,
passwordMemLimit: keysUtils.passwordMemLimits.min,
strictMemoryLock: false,
});
const dbPath = path.join(dataDir, 'db');
db = await DB.createDB({
Expand Down
8 changes: 5 additions & 3 deletions tests/sessions/SessionManager.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,12 @@ describe('SessionManager', () => {
keyRing = await KeyRing.createKeyRing({
password,
keysPath,
options: {
passwordOpsLimit: keysUtils.passwordOpsLimits.min,
passwordMemLimit: keysUtils.passwordMemLimits.min,
strictMemoryLock: false,
},
logger,
passwordOpsLimit: keysUtils.passwordOpsLimits.min,
passwordMemLimit: keysUtils.passwordMemLimits.min,
strictMemoryLock: false,
});
const dbPath = path.join(dataDir, 'db');
db = await DB.createDB({
Expand Down
10 changes: 6 additions & 4 deletions tests/sigchain/Sigchain.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,13 @@ describe(Sigchain.name, () => {
keyRing = await KeyRing.createKeyRing({
keysPath,
password,
privateKey,
options: {
privateKey,
passwordOpsLimit: keysUtils.passwordOpsLimits.min,
passwordMemLimit: keysUtils.passwordMemLimits.min,
strictMemoryLock: false,
},
logger,
passwordOpsLimit: keysUtils.passwordOpsLimits.min,
passwordMemLimit: keysUtils.passwordMemLimits.min,
strictMemoryLock: false,
});
dbPath = `${dataDir}/db`;
db = await DB.createDB({
Expand Down
4 changes: 2 additions & 2 deletions tests/utils/tls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type {
KeyPair,
} from '@/keys/types';
import type { TLSConfig } from '@/network/types';
import type { ClientCrypto, ServerCrypto } from '@matrixai/quic';
import type { ClientCryptoOps, ServerCryptoOps } from '@matrixai/quic';
import * as keysUtils from '@/keys/utils';
import * as testNodesUtils from '../nodes/utils';

Expand Down Expand Up @@ -63,7 +63,7 @@ async function createTLSConfigWithChain(
};
}

function createCrypto(): ServerCrypto & ClientCrypto {
function createCrypto(): ServerCryptoOps & ClientCryptoOps {
return {
randomBytes: async (data: ArrayBuffer) => {
const randomBytes = keysUtils.getRandomBytes(data.byteLength);
Expand Down

0 comments on commit ef77d6b

Please sign in to comment.