Skip to content

Commit

Permalink
chore: Stricter stream-tests (#3160)
Browse files Browse the repository at this point in the history
  • Loading branch information
ukstv authored Feb 14, 2024
1 parent 7cd8dea commit afe937e
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
2 changes: 2 additions & 0 deletions packages/core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
2 changes: 2 additions & 0 deletions packages/stream-tests/src/__tests__/caip10/caip-flows.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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}'`
)
Expand Down
5 changes: 3 additions & 2 deletions packages/stream-tests/src/create-ceramic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<Ceramic> {
const stateStoreDirectory = await tmp.tmpName()
const appliedConfig: CeramicConfig = mergeOpts(
const appliedConfig = mergeOpts(
{
stateStoreDirectory: stateStoreDirectory,
anchorOnRequest: false,
Expand Down
10 changes: 9 additions & 1 deletion packages/stream-tests/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -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/**/*"]
}

0 comments on commit afe937e

Please sign in to comment.