Skip to content

Commit

Permalink
test: remove some references to goerli network in tests to partially …
Browse files Browse the repository at this point in the history
…reduce flakiness
  • Loading branch information
mirceanis committed Aug 4, 2023
1 parent d046e49 commit f05c57a
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 19 deletions.
2 changes: 1 addition & 1 deletion __tests__/shared/resolveDid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default (testContext: {
afterAll(testContext.tearDown)

it('should resolve didUrl', async () => {
const didUrl = 'did:ethr:goerli:0xb09b66026ba5909a7cfe99b76875431d2b8d5190'
const didUrl = 'did:ethr:0xb09b66026ba5909a7cfe99b76875431d2b8d5190'
const didDoc = (await agent.resolveDid({ didUrl })).didDocument
expect(didDoc?.id).toEqual(didUrl)
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ describe('credential-LD full flow', () => {
new DIDManager({
providers: {
'did:key': new KeyDIDProvider({ defaultKms: 'local' }),
'did:ethr:goerli': new EthrDIDProvider({
'did:ethr': new EthrDIDProvider({
defaultKms: 'local',
network: 'goerli',
network: 'mainnet',
}),
},
store: new MemoryDIDStore(),
Expand All @@ -77,7 +77,7 @@ describe('credential-LD full flow', () => {
],
})
didKeyIdentifier = await agent.didManagerCreate()
didEthrIdentifier = await agent.didManagerCreate({ provider: 'did:ethr:goerli' })
didEthrIdentifier = await agent.didManagerCreate({ provider: 'did:ethr' })
})

it('create credential with inline context', async () => {
Expand Down
10 changes: 6 additions & 4 deletions packages/did-provider-ion/__tests__/ion-did-provider.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IIdentifier, IKey, IKeyManager, IService } from '../../core-types/src'
import { IDIDManager, IIdentifier, IKey, IKeyManager, IService } from '../../core-types/src'
import { createAgent } from '../../core/src'
import { DIDManager, MemoryDIDStore } from '../../did-manager/src'
import { KeyManager, MemoryKeyStore, MemoryPrivateKeyStore } from '../../key-manager/src'
Expand All @@ -14,7 +14,7 @@ jest.setTimeout(10000)
const ionDIDProvider = new IonDIDProvider({
defaultKms: 'mem',
})
const agent = createAgent<IKeyManager, DIDManager>({
const agent = createAgent<IKeyManager, IDIDManager>({
plugins: [
new KeyManager({
store: new MemoryKeyStore(),
Expand Down Expand Up @@ -58,7 +58,8 @@ describe('@veramo/did-provider-ion', () => {
})
})

// this fails with TypeError: Failed to parse URL from .../veramo/node_modules/.pnpm/argon2-browser@1.18.0/node_modules/argon2-browser/dist/argon2.wasm
// this fails with TypeError: Failed to parse URL from
// .../veramo/node_modules/.pnpm/argon2-browser@1.18.0/node_modules/argon2-browser/dist/argon2.wasm
it.skip('should add key', async () => {
// This DID is known in ION, hence no anchoring
const identifier: IIdentifier = await agent.didManagerCreate(
Expand Down Expand Up @@ -183,7 +184,8 @@ describe('@veramo/did-provider-ion', () => {
}
})

// this fails with TypeError: Failed to parse URL from .../veramo/node_modules/.pnpm/argon2-browser@1.18.0/node_modules/argon2-browser/dist/argon2.wasm
// this fails with TypeError: Failed to parse URL from
// .../veramo/node_modules/.pnpm/argon2-browser@1.18.0/node_modules/argon2-browser/dist/argon2.wasm
it.skip('should remove identifier', async () => {
const identifier: IIdentifier = await agent.didManagerCreate(
existingDidConfig(false, 'remove-test', PRIVATE_DID4_KEY_HEX),
Expand Down
21 changes: 10 additions & 11 deletions packages/did-resolver/src/__tests__/integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ jest.setTimeout(60000)

const providerConfig = {
networks: [
{ name: 'goerli', rpcUrl: 'https://goerli.infura.io/v3/3586660d179141e3801c3895de1c2eba' },
{ name: 'goerli', rpcUrl: 'https://goerli.infura.io/v3/3586660d179141e3801c3895de1c2eba' },
{ name: 'mainnet', rpcUrl: 'https://mainnet.infura.io/v3/3586660d179141e3801c3895de1c2eba' },
{ name: 'development', rpcUrl: 'http://localhost:7545' },
// FIXME: add this example
// { name: 'test', provider: TBD_add_example_of_custom_provider_usage },
Expand Down Expand Up @@ -69,24 +68,24 @@ describe('@veramo/did-resolver', () => {
it('should resolve ethr-did with RPC URL', async () => {
expect.assertions(1)
await expect(
resolverPlugin.resolveDid({ didUrl: 'did:ethr:goerli:0xE6Fe788d8ca214A080b0f6aC7F48480b2AEfa9a6' }),
resolverPlugin.resolveDid({ didUrl: 'did:ethr:mainnet:0xE6Fe788d8ca214A080b0f6aC7F48480b2AEfa9a6' }),
).resolves.toEqual({
didDocument: {
'@context': [
'https://www.w3.org/ns/did/v1',
'https://w3id.org/security/suites/secp256k1recovery-2020/v2',
],
id: 'did:ethr:goerli:0xE6Fe788d8ca214A080b0f6aC7F48480b2AEfa9a6',
id: 'did:ethr:mainnet:0xE6Fe788d8ca214A080b0f6aC7F48480b2AEfa9a6',
verificationMethod: [
{
id: 'did:ethr:goerli:0xE6Fe788d8ca214A080b0f6aC7F48480b2AEfa9a6#controller',
id: 'did:ethr:mainnet:0xE6Fe788d8ca214A080b0f6aC7F48480b2AEfa9a6#controller',
type: 'EcdsaSecp256k1RecoveryMethod2020',
controller: 'did:ethr:goerli:0xE6Fe788d8ca214A080b0f6aC7F48480b2AEfa9a6',
blockchainAccountId: 'eip155:5:0xE6Fe788d8ca214A080b0f6aC7F48480b2AEfa9a6',
controller: 'did:ethr:mainnet:0xE6Fe788d8ca214A080b0f6aC7F48480b2AEfa9a6',
blockchainAccountId: 'eip155:1:0xE6Fe788d8ca214A080b0f6aC7F48480b2AEfa9a6',
},
],
authentication: ['did:ethr:goerli:0xE6Fe788d8ca214A080b0f6aC7F48480b2AEfa9a6#controller'],
assertionMethod: ['did:ethr:goerli:0xE6Fe788d8ca214A080b0f6aC7F48480b2AEfa9a6#controller'],
authentication: ['did:ethr:mainnet:0xE6Fe788d8ca214A080b0f6aC7F48480b2AEfa9a6#controller'],
assertionMethod: ['did:ethr:mainnet:0xE6Fe788d8ca214A080b0f6aC7F48480b2AEfa9a6#controller'],
},
didDocumentMetadata: {},
didResolutionMetadata: { contentType: 'application/did+ld+json' },
Expand All @@ -102,9 +101,9 @@ describe('@veramo/did-resolver', () => {
it('should resolve ethr-did with RPC URL using direct constructor', async () => {
expect.assertions(1)
const result = await resolverPluginDirect.resolveDid({
didUrl: 'did:ethr:goerli:0xE6Fe788d8ca214A080b0f6aC7F48480b2AEfa9a6',
didUrl: 'did:ethr:0xE6Fe788d8ca214A080b0f6aC7F48480b2AEfa9a6',
})
expect(result?.didDocument?.id).toEqual('did:ethr:goerli:0xE6Fe788d8ca214A080b0f6aC7F48480b2AEfa9a6')
expect(result?.didDocument?.id).toEqual('did:ethr:0xE6Fe788d8ca214A080b0f6aC7F48480b2AEfa9a6')
})

it('should fail predictably when unsupported method is resolved', async () => {
Expand Down

0 comments on commit f05c57a

Please sign in to comment.