From afe937e898bc9a6fe4d541cd59a9245ad0810892 Mon Sep 17 00:00:00 2001 From: Sergey Ukustov Date: Wed, 14 Feb 2024 18:10:24 +0300 Subject: [PATCH] chore: Stricter stream-tests (#3160) --- packages/core/src/index.ts | 2 ++ .../stream-tests/src/__tests__/caip10/caip-flows.ts | 2 ++ packages/stream-tests/src/create-ceramic.ts | 5 +++-- packages/stream-tests/tsconfig.json | 10 +++++++++- 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts index d7150dd270..ca8e66c2a1 100644 --- a/packages/core/src/index.ts +++ b/packages/core/src/index.ts @@ -4,3 +4,5 @@ export * from './store/ikv-store.js' export * from './ceramic.js' export * from './pubsub/pubsub-message.js' export * from './utils.js' + +export { ProvidersCache } from './providers-cache.js' diff --git a/packages/stream-tests/src/__tests__/caip10/caip-flows.ts b/packages/stream-tests/src/__tests__/caip10/caip-flows.ts index ae3d0a2faa..a8e002009b 100644 --- a/packages/stream-tests/src/__tests__/caip10/caip-flows.ts +++ b/packages/stream-tests/src/__tests__/caip10/caip-flows.ts @@ -5,6 +5,7 @@ import { AccountId } from 'caip' import { Ceramic } from '@ceramicnetwork/core' export async function happyPath(ceramic: Ceramic, authProvider: AuthProvider) { + if (!ceramic.did) throw new Error(`No ceramic.did present`) const accountId = await authProvider.accountId() const caip = await Caip10Link.fromAccount(ceramic, accountId) await caip.setDid(ceramic.did, authProvider) @@ -27,6 +28,7 @@ export async function wrongProof( const legacyLinkAccountId = toLegacyAccountId(wrongAccountId.toString()).toLowerCase() const caip = await Caip10Link.fromAccount(ceramic, wrongAccountId) + if (!ceramic.did) throw new Error(`No ceramic.did present`) await expect(caip.setDid(ceramic.did, authProvider)).rejects.toThrow( `Address '${legacySigningAccountId}' used to sign update to Caip10Link doesn't match stream controller '${legacyLinkAccountId}'` ) diff --git a/packages/stream-tests/src/create-ceramic.ts b/packages/stream-tests/src/create-ceramic.ts index 527b83a09e..9aa8dd77ea 100644 --- a/packages/stream-tests/src/create-ceramic.ts +++ b/packages/stream-tests/src/create-ceramic.ts @@ -3,14 +3,15 @@ import { CeramicConfig, Ceramic } from '@ceramicnetwork/core' import { IpfsApi } from '@ceramicnetwork/common' import tmp from 'tmp-promise' import { createDid } from './create_did.js' +import type { ProvidersCache } from '@ceramicnetwork/core' export async function createCeramic( ipfs: IpfsApi, config: CeramicConfig & { seed?: string } = {}, - providersCache? + providersCache?: ProvidersCache ): Promise { const stateStoreDirectory = await tmp.tmpName() - const appliedConfig: CeramicConfig = mergeOpts( + const appliedConfig = mergeOpts( { stateStoreDirectory: stateStoreDirectory, anchorOnRequest: false, diff --git a/packages/stream-tests/tsconfig.json b/packages/stream-tests/tsconfig.json index d7513b6a8b..f62e63e9b2 100644 --- a/packages/stream-tests/tsconfig.json +++ b/packages/stream-tests/tsconfig.json @@ -2,7 +2,15 @@ "extends": "../../tsconfig.json", "compilerOptions": { "outDir": "lib", - "rootDir": "src" + "rootDir": "src", + "strict": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true, + "noImplicitOverride": true, + "noPropertyAccessFromIndexSignature": true, + "noUncheckedIndexedAccess": true, + "noUnusedLocals": true, + "noUnusedParameters": true }, "include": ["./src/**/*"] }