Skip to content

Commit

Permalink
feat: added contact test data
Browse files Browse the repository at this point in the history
  • Loading branch information
sksadjad committed Sep 13, 2023
1 parent a177c52 commit daeb87d
Showing 1 changed file with 50 additions and 1 deletion.
51 changes: 50 additions & 1 deletion packages/contact-manager-rest-api/__tests__/agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ import { DataStore, DataStoreORM } from '@veramo/data-store'
import { IRequiredPlugins } from '../src'
import { DB_CONNECTION_NAME, sqliteConfig } from './database'
import { ContactManager } from '@sphereon/ssi-sdk.contact-manager'
import { ContactStore } from '@sphereon/ssi-sdk.data-store'
import { ContactStore, PartyTypeEnum } from '@sphereon/ssi-sdk.data-store'
import { DataSources } from '@sphereon/ssi-sdk.agent-config'
import { v4 } from 'uuid'

const dbConnection = DataSources.singleInstance()
.addConfig(DB_CONNECTION_NAME, sqliteConfig)
Expand All @@ -14,4 +15,52 @@ const agent = createAgent<IRequiredPlugins>({
plugins: [new DataStore(dbConnection), new DataStoreORM(dbConnection), new ContactManager({ store: new ContactStore(dbConnection) })],
})

agent.cmAddContactType({
name: `${v4()}-people`,
type: PartyTypeEnum.NATURAL_PERSON,
tenantId: v4()
}).then(ct=> {
agent.cmAddContact({
"firstName": "emp1_fn",
"middleName": "emp1_mn",
"lastName": "emp1_ln",
"displayName": "emp1_dn",
contactType: ct,
uri: "emp1_url"
})
agent.cmAddContact({
"firstName": "emp2_fn",
"middleName": "emp2_mn",
"lastName": "emp2_ln",
"displayName": "emp2_dn",
contactType: ct,
uri: "emp2_url"
})
agent.cmAddContact({
"firstName": "emp3_fn",
"middleName": "emp3_mn",
"lastName": "emp3_ln",
"displayName": "emp3_dn",
contactType: ct,
uri: "emp2_url"
})
})
agent.cmAddContactType({
name: `${v4()}-orgzanizations`,
type: PartyTypeEnum.ORGANIZATION,
tenantId: v4()
}).then(ct=> {
agent.cmAddContact({
legalName: `${v4()}-org1_fn`,
displayName: "org1_dn",
contactType: ct,
uri: "org1_uri"
})
agent.cmAddContact({
legalName: `${v4()}-org2_fn`,
displayName: "org2_dn",
contactType: ct,
uri: "org2_uri"
})
})
export default agent

0 comments on commit daeb87d

Please sign in to comment.