Skip to content

Commit

Permalink
add test for info.json
Browse files Browse the repository at this point in the history
  • Loading branch information
finn-block committed Nov 17, 2023
1 parent 2e88e2c commit 1273a13
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/http-api.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ describe('http api', function () {
clock = useFakeTimers({ shouldAdvanceTime: true });

config.registrationRequirementPow = true;
config.registrationRequirementTos = './tests/fixtures/tos.txt';
const testdwn = await getTestDwn(true, true);
dwn = testdwn.dwn;
tenantGate = testdwn.tenantGate;
Expand Down Expand Up @@ -902,4 +903,18 @@ describe('http api', function () {
expect(response.status).to.equal(404);
});
});

describe('/info.json', function () {
it('verify /info.json has some of the fields it is supposed to have', async function () {
const resp = await fetch(`http://localhost:3000/info.json`);
expect(resp.status).to.equal(200);

const info = await resp.json();
expect(info['server']).to.equal('@web5/dwn-server');
expect(info['registrationRequirements']).to.include('terms-of-service');
expect(info['registrationRequirements']).to.include(
'proof-of-work-sha256-v0',
);
});
});
});

0 comments on commit 1273a13

Please sign in to comment.