From 561f475ecf5be74e4f3cf8b530e7bc892af24860 Mon Sep 17 00:00:00 2001 From: Frank Hinek Date: Tue, 16 May 2023 21:34:36 -0400 Subject: [PATCH] Chores (typos, unused imports, etc.) and revert Web5 User Agent test endpoints Signed-off-by: Frank Hinek --- packages/dids/tests/did-key.spec.ts | 2 +- .../tests/common/web5-user-agent.spec.ts | 19 ++++++++----------- packages/web5/src/dwn-api.ts | 2 +- packages/web5/tests/web5-dwn.spec.ts | 2 +- 4 files changed, 11 insertions(+), 14 deletions(-) diff --git a/packages/dids/tests/did-key.spec.ts b/packages/dids/tests/did-key.spec.ts index d9033e38f..ea5775ee3 100644 --- a/packages/dids/tests/did-key.spec.ts +++ b/packages/dids/tests/did-key.spec.ts @@ -4,7 +4,7 @@ import { DidKeyApi } from '../src/did-key.js'; const DidKey = new DidKeyApi(); describe('DidKeyApi', () => { - it.only('works', async () => { + it('works', async () => { const didState = await DidKey.create(); expect(didState.id).to.exist; diff --git a/packages/web5-user-agent/tests/common/web5-user-agent.spec.ts b/packages/web5-user-agent/tests/common/web5-user-agent.spec.ts index 37342d34a..3b9041d53 100644 --- a/packages/web5-user-agent/tests/common/web5-user-agent.spec.ts +++ b/packages/web5-user-agent/tests/common/web5-user-agent.spec.ts @@ -2,8 +2,10 @@ import { expect } from 'chai'; import { Encoder, RecordsWriteMessage, RecordsRead } from '@tbd54566975/dwn-sdk-js'; import { TestAgent } from './utils/test-user-agent.js'; -let testAgent: TestAgent; let did: string; +let dwnNodes: string[] = ['https://dwn.tbddev.org/dwn0']; +// let dwnNodes: string[] = ['http://localhost:3000']; +let testAgent: TestAgent; describe('Web5UserAgent', () => { before(async () => { @@ -47,8 +49,7 @@ describe('Web5UserAgent', () => { type : 'dwn', id : 'dwn', serviceEndpoint : { - // nodes: ['https://dwn.tbddev.org/dwn0'] - nodes: ['http://localhost:3000'] + nodes: dwnNodes } }] } @@ -80,8 +81,7 @@ describe('Web5UserAgent', () => { type : 'dwn', id : 'dwn', serviceEndpoint : { - // nodes: ['https://dwn.tbddev.org/dwn0'] - nodes: ['http://localhost:3000'] + nodes: dwnNodes } }] } @@ -101,22 +101,20 @@ describe('Web5UserAgent', () => { expect(response.reply.status.code).to.equal(404); }); - it('returns something when an jwark is smorked', async () => { + it('throws an error when DwnRequest fails validation', async () => { const { did: aliceDid } = await testAgent.createProfile({ profileDidOptions: { services: [{ type : 'dwn', id : 'dwn', serviceEndpoint : { - // nodes: ['https://dwn.tbddev.org/dwn0'] - nodes: ['http://localhost:3000'] + nodes: dwnNodes } }] } }); try { - // TODO: (Moe -> Frank): what should sendDwnRequest return and how does it propogate back up to the caller? await testAgent.agent.sendDwnRequest({ author : aliceDid, target : aliceDid, @@ -138,8 +136,7 @@ describe('Web5UserAgent', () => { type : 'dwn', id : 'dwn', serviceEndpoint : { - // nodes: ['https://dwn.tbddev.org/dwn0'] - nodes: ['http://localhost:3000'] + nodes: dwnNodes } }] } diff --git a/packages/web5/src/dwn-api.ts b/packages/web5/src/dwn-api.ts index 13e500028..61f8e2269 100644 --- a/packages/web5/src/dwn-api.ts +++ b/packages/web5/src/dwn-api.ts @@ -17,7 +17,7 @@ import { DwnInterfaceName, DwnMethodName } from '@tbd54566975/dwn-sdk-js'; import { Record } from './record.js'; import { Protocol } from './protocol.js'; -import { dataToBlob, isDataSizeUnderCacheLimit, isEmptyObject } from './utils.js'; +import { dataToBlob, isEmptyObject } from './utils.js'; // TODO: Export type ProtocolsConfigureDescriptor from dwn-sdk-js. export type ProtocolsConfigureDescriptor = { diff --git a/packages/web5/tests/web5-dwn.spec.ts b/packages/web5/tests/web5-dwn.spec.ts index 8af3eb59f..6bceeb22d 100644 --- a/packages/web5/tests/web5-dwn.spec.ts +++ b/packages/web5/tests/web5-dwn.spec.ts @@ -44,7 +44,7 @@ describe('web5.dwn', () => { }); describe('from: did', () => { - xit('test neeed'); + xit('test needed'); }); });