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

fix: connection record type was BaseRecord #278

Merged
merged 3 commits into from
May 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 1 addition & 3 deletions samples/__tests__/e2e-ws.test.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import { Agent, InboundTransporter, WsOutboundTransporter } from '../../src'
import { get } from '../http'
import { getBaseConfig, toBeConnectedWith, waitForBasicMessage } from '../../src/__tests__/helpers'
import { getBaseConfig, waitForBasicMessage } from '../../src/__tests__/helpers'
import testLogger from '../../src/__tests__/logger'

const logger = testLogger

expect.extend({ toBeConnectedWith })

const aliceConfig = getBaseConfig('E2E Alice WebSockets', { mediatorUrl: 'http://localhost:3003' })
const bobConfig = getBaseConfig('E2E Bob WebSockets', { mediatorUrl: 'http://localhost:3004' })

Expand Down
4 changes: 1 addition & 3 deletions samples/__tests__/e2e.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import { Agent, HttpOutboundTransporter, InboundTransporter } from '../../src'
import { get } from '../http'
import { getBaseConfig, sleep, toBeConnectedWith, waitForBasicMessage } from '../../src/__tests__/helpers'
import { getBaseConfig, sleep, waitForBasicMessage } from '../../src/__tests__/helpers'
import logger from '../../src/__tests__/logger'

expect.extend({ toBeConnectedWith })

const aliceConfig = getBaseConfig('E2E Alice', { mediatorUrl: 'http://localhost:3001' })
const bobConfig = getBaseConfig('E2E Bob', { mediatorUrl: 'http://localhost:3002' })

Expand Down
10 changes: 1 addition & 9 deletions src/__tests__/agents.test.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,8 @@
import { Subject } from 'rxjs'
import { Agent } from '..'
import {
toBeConnectedWith,
SubjectInboundTransporter,
SubjectOutboundTransporter,
waitForBasicMessage,
getBaseConfig,
} from './helpers'
import { SubjectInboundTransporter, SubjectOutboundTransporter, waitForBasicMessage, getBaseConfig } from './helpers'
import { ConnectionRecord } from '../modules/connections'

expect.extend({ toBeConnectedWith })

const aliceConfig = getBaseConfig('Agents Alice')
const bobConfig = getBaseConfig('Agents Bob')

Expand Down
3 changes: 3 additions & 0 deletions src/__tests__/setup.ts
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
import 'reflect-metadata'
import { toBeConnectedWith } from './helpers'

expect.extend({ toBeConnectedWith })
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import 'reflect-metadata'

export { Agent } from './agent/Agent'
export { encodeInvitationToUrl, decodeInvitationFromUrl } from './helpers'
export { InitConfig, OutboundPackage } from './types'
export { InitConfig, OutboundPackage, DidCommMimeType } from './types'

export * from './transport'
export * from './modules/basic-messages'
Expand Down
3 changes: 2 additions & 1 deletion src/modules/connections/__tests__/ConnectionService.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,11 @@ describe('ConnectionService', () => {

describe('createConnectionWithInvitation', () => {
it('returns a connection record with values set', async () => {
expect.assertions(6)
expect.assertions(7)

const { connectionRecord: connectionRecord } = await connectionService.createInvitation()

expect(connectionRecord.type).toBe('ConnectionRecord')
expect(connectionRecord.role).toBe(ConnectionRole.Inviter)
expect(connectionRecord.state).toBe(ConnectionState.Invited)
expect(connectionRecord.autoAcceptConnection).toBeUndefined()
Expand Down
2 changes: 1 addition & 1 deletion src/modules/connections/repository/ConnectionRecord.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export class ConnectionRecord extends BaseRecord implements ConnectionStoragePro
public autoAcceptConnection?: boolean
public tags!: ConnectionTags

public static readonly type: 'ConnectionRecord'
public static readonly type = 'ConnectionRecord'
public readonly type = ConnectionRecord.type

public constructor(props: ConnectionStorageProps) {
Expand Down