X-Git-Url: http://git.squeep.com/?p=websub-hub;a=blobdiff_plain;f=test%2Fsrc%2Fcommunication.js;h=d5ebe54222664863411dd4fcf4898cf3a9028a6a;hp=960a0f994b27a572236a92131638b326c59f4ece;hb=71efac9dcd7dc219cb83799391e7adc63cd4c662;hpb=8ac5b7115094d9044ee26a1a4e2334b5ff6ef40c diff --git a/test/src/communication.js b/test/src/communication.js index 960a0f9..d5ebe54 100644 --- a/test/src/communication.js +++ b/test/src/communication.js @@ -552,6 +552,8 @@ describe('Communication', function () { headers: { 'content-type': 'text/plain', link: '; rel="hub"', + 'last-modified': 'Thu, 18 Nov 2021 20:34:35 GMT', + 'etag': '"9c104-1673e-5d1161636d742"', }, data: 'Jackdaws love my big sphinx of quartz.', }); @@ -631,6 +633,20 @@ describe('Communication', function () { assert(!communication.db.topicSetContent.called); }); + it('recognizes 304 response', async function () { + topic.httpLastModified = 'Thu, 18 Nov 2021 20:34:35 GMT'; + topic.httpEtag = '"9c104-1673e-5d1161636d742"'; + communication.db.topicGetById.resolves(topic); + communication.axios.resolves({ + status: 304, + }); + + await communication.topicFetchProcess(dbCtx, topicId, requestId); + + assert(communication.db.topicFetchComplete.called); + assert(!communication.db.topicSetContent.called); + }); + it('updates content', async function () { await communication.topicFetchProcess(dbCtx, topicId, requestId);