diff --git a/README.md b/README.md index a7e6614cb..a6d960cb0 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ # Decentralized Web Node (DWN) SDK Code Coverage -![Statements](https://img.shields.io/badge/statements-97.38%25-brightgreen.svg?style=flat) ![Branches](https://img.shields.io/badge/branches-94.35%25-brightgreen.svg?style=flat) ![Functions](https://img.shields.io/badge/functions-93.73%25-brightgreen.svg?style=flat) ![Lines](https://img.shields.io/badge/lines-97.38%25-brightgreen.svg?style=flat) +![Statements](https://img.shields.io/badge/statements-97.56%25-brightgreen.svg?style=flat) ![Branches](https://img.shields.io/badge/branches-94.6%25-brightgreen.svg?style=flat) ![Functions](https://img.shields.io/badge/functions-93.86%25-brightgreen.svg?style=flat) ![Lines](https://img.shields.io/badge/lines-97.56%25-brightgreen.svg?style=flat) - [Introduction](#introduction) diff --git a/tests/handlers/messages-get.spec.ts b/tests/handlers/messages-get.spec.ts index b8124fed3..4d4f7cd95 100644 --- a/tests/handlers/messages-get.spec.ts +++ b/tests/handlers/messages-get.spec.ts @@ -178,108 +178,6 @@ export function testMessagesGetHandler(): void { } }); - // it('calls dataStore for data when encodedData is below a threshold and encodedData is not set', async () => { - // const alice = await DidKeyResolver.generate(); - // const { recordsWrite, dataStream, dataBytes } = await TestDataGenerator.generateRecordsWrite({ - // author : alice, - // data : TestDataGenerator.randomBytes(DwnConstant.maxDataSizeAllowedToBeEncoded) - // }); - // const { message } = recordsWrite; - - // const writeReply = await dwn.processMessage(alice.did, message, dataStream); - // expect(writeReply.status.code).to.equal(202); - - // const recordsWriteMessageCid = await Message.getCid(message); - - // // messageStore.get resolves recordsWrite without encodedData set - // sinon.stub(messageStore, 'get') - // .withArgs(alice.did, recordsWriteMessageCid) - // .resolves(message); - - // const responseStream = DataStream.fromBytes(dataBytes!); - // const getStub = sinon.stub(dataStore, 'get'); - // getStub.withArgs(alice.did, recordsWriteMessageCid, message.descriptor.dataCid) - // .resolves({ - // dataCid : message.descriptor.dataCid, - // dataSize : message.descriptor.dataSize, - // dataStream : responseStream, - // }); - - // const { message: getMessage } = await TestDataGenerator.generateMessagesGet({ - // author : alice, - // messageCids : [recordsWriteMessageCid] - // }); - - // const reply: MessagesGetReply = await dwn.processMessage(alice.did, getMessage); - // expect(reply.status.code).to.equal(200); - // expect(reply.messages!.length).to.equal(1); - // expect(reply.messages![0].messageCid).to.equal(recordsWriteMessageCid); - - // sinon.assert.calledOnce(getStub); - // expect(reply.messages![0].encodedData).to.equal(Encoder.bytesToBase64Url(dataBytes!)); - // }); - - // it('calls dataStore for data when encodedData is below a threshold and encodedData is not set and there is no underlying data', async () => { - // const alice = await DidKeyResolver.generate(); - // const { recordsWrite, dataStream } = await TestDataGenerator.generateRecordsWrite({ - // author : alice, - // data : TestDataGenerator.randomBytes(DwnConstant.maxDataSizeAllowedToBeEncoded) - // }); - // const { message } = recordsWrite; - - // const writeReply = await dwn.processMessage(alice.did, message, dataStream); - // expect(writeReply.status.code).to.equal(202); - - // const recordsWriteMessageCid = await Message.getCid(message); - - // // messageStore.get resolves recordsWrite without encodedData set - // sinon.stub(messageStore, 'get') - // .withArgs(alice.did, recordsWriteMessageCid) - // .resolves(message); - - // const getStub = sinon.stub(dataStore, 'get'); - // getStub.withArgs(alice.did, recordsWriteMessageCid, message.descriptor.dataCid) - // .resolves(undefined); - - // const { message: getMessage } = await TestDataGenerator.generateMessagesGet({ - // author : alice, - // messageCids : [recordsWriteMessageCid] - // }); - - // const reply: MessagesGetReply = await dwn.processMessage(alice.did, getMessage); - // expect(reply.status.code).to.equal(200); - // expect(reply.messages!.length).to.equal(1); - // expect(reply.messages![0].messageCid).to.equal(recordsWriteMessageCid); - - // sinon.assert.calledOnce(getStub); - // expect(reply.messages![0].encodedData).to.be.undefined; - // }); - - // it('does not call dataStore for data when encodedData is below a threshold and encodedData is set', async () => { - // const alice = await DidKeyResolver.generate(); - // const { recordsWrite, dataStream } = await TestDataGenerator.generateRecordsWrite({ - // author : alice, - // data : TestDataGenerator.randomBytes(DwnConstant.maxDataSizeAllowedToBeEncoded) - // }); - // const writeReply = await dwn.processMessage(alice.did, recordsWrite.message, dataStream); - // expect(writeReply.status.code).to.equal(202); - - // const dataStoreGet = sinon.spy(dataStore, 'get'); - - // const recordsWriteMessageCid = await Message.getCid(recordsWrite.message); - // const { message } = await TestDataGenerator.generateMessagesGet({ - // author : alice, - // messageCids : [recordsWriteMessageCid] - // }); - - // const reply: MessagesGetReply = await dwn.processMessage(alice.did, message); - // expect(reply.status.code).to.equal(200); - // expect(reply.messages!.length).to.equal(1); - // expect(reply.messages![0].messageCid).to.equal(recordsWriteMessageCid); - - // sinon.assert.notCalled(dataStoreGet); - // }); - it('returns an error message for a specific cid if getting that message from the MessageStore fails', async () => { // stub the messageStore.get call to throw an error const messageStore = stubInterface();