Skip to content

Commit

Permalink
clean up unecesary interface method
Browse files Browse the repository at this point in the history
  • Loading branch information
LiranCohen committed Jul 11, 2024
1 parent e09eb55 commit dc62b6f
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 13 deletions.
2 changes: 0 additions & 2 deletions packages/agent/src/store-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ export type DataStoreDeleteParams = DataStoreTenantParams & {
}

export interface AgentDataStore<TStoreObject> {
initialize({ tenant, agent }: DataStoreTenantParams): Promise<void>;

delete(params: DataStoreDeleteParams): Promise<boolean>;

get(params: DataStoreGetParams): Promise<TStoreObject | undefined>;
Expand Down
6 changes: 3 additions & 3 deletions packages/agent/tests/store-data.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ describe('AgentDataStore', () => {
const didBytes = Convert.string(new Array(102400 + 1).join('0')).toUint8Array();

// since we are writing directly to the dwn we first initialize the storage protocol
await testStore.initialize({ agent: testHarness.agent });
await (testStore as DwnDataStore<PortableDid>)['initialize']({ agent: testHarness.agent });

// Store the DID in the DWN.
const response = await testHarness.agent.dwn.processRequest({
Expand Down Expand Up @@ -581,8 +581,8 @@ describe('AgentDataStore', () => {
// Skip this test for InMemoryTestStore, as it is only relevant for the DWN store.
if (TestStore.name === 'InMemoryTestStore') this.skip();

// have the protocol installed before dwn api stub
await testStore.initialize({ agent: testHarness.agent });
// since we are writing directly to the dwn we first initialize the storage protocol
await (testStore as DwnDataStore<PortableDid>)['initialize']({ agent: testHarness.agent });

// Stub the DWN API to return a failed response.
const dwnApiStub = sinon.stub(testHarness.agent.dwn, 'processRequest').resolves({
Expand Down
4 changes: 2 additions & 2 deletions packages/agent/tests/store-did.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { expect } from 'chai';
import { Convert } from '@web5/common';
import { DidJwk, PortableDid } from '@web5/dids';

import type { AgentDataStore } from '../src/store-data.js';
import type { AgentDataStore, DwnDataStore } from '../src/store-data.js';

import { AgentDidApi } from '../src/did-api.js';
import { TestAgent } from './utils/test-agent.js';
Expand Down Expand Up @@ -211,7 +211,7 @@ describe('DidStore', () => {
const didBytes = Convert.string(new Array(102400 + 1).join('0')).toUint8Array();

// since we are writing directly to the dwn we first initialize the storage protocol
await didStore.initialize({ agent: testHarness.agent });
await (didStore as DwnDataStore<PortableDid>)['initialize']({ agent: testHarness.agent });

// Store the DID in the DWN.
const response = await testHarness.agent.dwn.processRequest({
Expand Down
7 changes: 3 additions & 4 deletions packages/agent/tests/store-identity.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { expect } from 'chai';
import { DidJwk } from '@web5/dids';
import { Convert } from '@web5/common';

import type { AgentDataStore } from '../src/store-data.js';
import type { AgentDataStore, DwnDataStore } from '../src/store-data.js';
import type { IdentityMetadata } from '../src/types/identity.js';

import { TestAgent } from './utils/test-agent.js';
Expand Down Expand Up @@ -200,9 +200,8 @@ describe('IdentityStore', () => {
// regardless of the size of the data.
if (IdentityStore.name === 'InMemoryIdentityStore') this.skip();

// since we are testing by issuing a RecordsWrite directly to the DWN without the `identityStore` abstraction,
// we need to ensure the AgentStore protocol is initialized.
await identityStore.initialize({ agent: testHarness.agent });
// since we are writing directly to the dwn we first initialize the storage protocol
await (identityStore as DwnDataStore<IdentityMetadata>)['initialize']({ agent: testHarness.agent });

const identityBytes = Convert.string(new Array(102400 + 1).join('0')).toUint8Array();

Expand Down
4 changes: 2 additions & 2 deletions packages/agent/tests/store-key.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type { Jwk } from '@web5/crypto';
import { expect } from 'chai';
import { Convert } from '@web5/common';

import type { AgentDataStore } from '../src/store-data.js';
import type { AgentDataStore, DwnDataStore } from '../src/store-data.js';

import { TestAgent } from './utils/test-agent.js';
import { DwnInterface } from '../src/types/dwn.js';
Expand Down Expand Up @@ -133,7 +133,7 @@ describe('KeyStore', () => {
const keyBytes = Convert.string(new Array(102400 + 1).join('0')).toUint8Array();

// since we are writing directly to the dwn we first initialize the storage protocol
await keyStore.initialize({ agent: testHarness.agent });
await (keyStore as DwnDataStore<Jwk>)['initialize']({ agent: testHarness.agent });

// Store the DID in the DWN.
const response = await testHarness.agent.dwn.processRequest({
Expand Down

0 comments on commit dc62b6f

Please sign in to comment.