From 40197b92aff4443eae7f48d4df1f35dd80ee1601 Mon Sep 17 00:00:00 2001 From: James Chartrand Date: Mon, 9 Sep 2024 17:46:57 -0400 Subject: [PATCH] linting fixes --- src/app.test.js | 8 ++-- src/test-fixtures/nocks/did-key-generator.js | 43 ++++++++++---------- src/test-fixtures/nocks/did-web-generator.js | 43 ++++++++++---------- 3 files changed, 46 insertions(+), 48 deletions(-) diff --git a/src/app.test.js b/src/app.test.js index 982aaf3..6fe222b 100644 --- a/src/app.test.js +++ b/src/app.test.js @@ -12,7 +12,6 @@ import statusListNock from './test-fixtures/nocks/status_list_nock.js' import didWebGeneratorNock from './test-fixtures/nocks/did-web-generator.js' import didKeyGeneratorNock from './test-fixtures/nocks/did-key-generator.js' - import { build } from './app.js' let testTenantToken @@ -258,12 +257,13 @@ describe('api', () => { it('returns a new did:web', async () => { didWebGeneratorNock() await request(app) - .post(`/did-web-generator`) + .post('/did-web-generator') .send({ url: 'https://raw.githubusercontent.com/jchartrand/didWebTest/main' }) .expect('Content-Type', /json/) .expect((res) => { + // eslint-disable-next-line expect(res.body.seed).to.exist expect(res.body.didDocument.id).to.eql( 'did:web:raw.githubusercontent.com:jchartrand:didWebTest:main' @@ -280,9 +280,10 @@ describe('api', () => { it('returns a new did:key', async () => { didKeyGeneratorNock() await request(app) - .get(`/did-key-generator`) + .get('/did-key-generator') .expect('Content-Type', /json/) .expect((res) => { + // eslint-disable-next-line expect(res.body.seed).to.exist expect(res.body.didDocument.id).to.contain('did:key') expect(res.body.did).to.contain('did:key') @@ -290,5 +291,4 @@ describe('api', () => { .expect(200) }) }) - }) diff --git a/src/test-fixtures/nocks/did-key-generator.js b/src/test-fixtures/nocks/did-key-generator.js index dd296cb..9c2db55 100644 --- a/src/test-fixtures/nocks/did-key-generator.js +++ b/src/test-fixtures/nocks/did-key-generator.js @@ -1,25 +1,24 @@ import nock from 'nock' -export default () => { - - nock('http://localhost:4006', {"encodedQueryParams":true}) - .get('/did-key-generator') - .reply(200, {"seed":"z1Ak67saZZnW6e41kw8dFNgWPQC7kb4MgmKrB5Saj9fTQtR","decodedSeed":{"0":204,"1":42,"2":201,"3":165,"4":122,"5":6,"6":144,"7":61,"8":229,"9":222,"10":134,"11":94,"12":219,"13":6,"14":191,"15":210,"16":103,"17":71,"18":241,"19":109,"20":215,"21":216,"22":2,"23":72,"24":19,"25":144,"26":20,"27":32,"28":178,"29":172,"30":81,"31":82},"did":"did:key:z6Mkq5Vr5kEEUF6M8U7AgSKBVppXyNQBoWnyb1vMqedzN3ha","didDocument":{"@context":["https://www.w3.org/ns/did/v1","https://w3id.org/security/suites/ed25519-2020/v1","https://w3id.org/security/suites/x25519-2020/v1"],"id":"did:key:z6Mkq5Vr5kEEUF6M8U7AgSKBVppXyNQBoWnyb1vMqedzN3ha","verificationMethod":[{"id":"did:key:z6Mkq5Vr5kEEUF6M8U7AgSKBVppXyNQBoWnyb1vMqedzN3ha#z6Mkq5Vr5kEEUF6M8U7AgSKBVppXyNQBoWnyb1vMqedzN3ha","type":"Ed25519VerificationKey2020","controller":"did:key:z6Mkq5Vr5kEEUF6M8U7AgSKBVppXyNQBoWnyb1vMqedzN3ha","publicKeyMultibase":"z6Mkq5Vr5kEEUF6M8U7AgSKBVppXyNQBoWnyb1vMqedzN3ha"}],"authentication":["did:key:z6Mkq5Vr5kEEUF6M8U7AgSKBVppXyNQBoWnyb1vMqedzN3ha#z6Mkq5Vr5kEEUF6M8U7AgSKBVppXyNQBoWnyb1vMqedzN3ha"],"assertionMethod":["did:key:z6Mkq5Vr5kEEUF6M8U7AgSKBVppXyNQBoWnyb1vMqedzN3ha#z6Mkq5Vr5kEEUF6M8U7AgSKBVppXyNQBoWnyb1vMqedzN3ha"],"capabilityDelegation":["did:key:z6Mkq5Vr5kEEUF6M8U7AgSKBVppXyNQBoWnyb1vMqedzN3ha#z6Mkq5Vr5kEEUF6M8U7AgSKBVppXyNQBoWnyb1vMqedzN3ha"],"capabilityInvocation":["did:key:z6Mkq5Vr5kEEUF6M8U7AgSKBVppXyNQBoWnyb1vMqedzN3ha#z6Mkq5Vr5kEEUF6M8U7AgSKBVppXyNQBoWnyb1vMqedzN3ha"],"keyAgreement":[{"id":"did:key:z6Mkq5Vr5kEEUF6M8U7AgSKBVppXyNQBoWnyb1vMqedzN3ha#z6LScqycbURGxJztJiSkK6MKZJhujV7PygbA2BHexuriMAdr","type":"X25519KeyAgreementKey2020","controller":"did:key:z6Mkq5Vr5kEEUF6M8U7AgSKBVppXyNQBoWnyb1vMqedzN3ha","publicKeyMultibase":"z6LScqycbURGxJztJiSkK6MKZJhujV7PygbA2BHexuriMAdr"}]}}, [ - 'X-Powered-By', - 'Express', - 'Access-Control-Allow-Origin', - '*', - 'Content-Type', - 'application/json; charset=utf-8', - 'Content-Length', - '1776', - 'ETag', - 'W/"6f0-JdoCppKv4nbnXnQDbZJxlFrXG7o"', - 'Date', - 'Mon, 09 Sep 2024 18:06:31 GMT', - 'Connection', - 'keep-alive', - 'Keep-Alive', - 'timeout=5' -]); +export default () => { + nock('http://localhost:4006', { encodedQueryParams: true }) + .get('/did-key-generator') + .reply(200, { seed: 'z1Ak67saZZnW6e41kw8dFNgWPQC7kb4MgmKrB5Saj9fTQtR', decodedSeed: { 0: 204, 1: 42, 2: 201, 3: 165, 4: 122, 5: 6, 6: 144, 7: 61, 8: 229, 9: 222, 10: 134, 11: 94, 12: 219, 13: 6, 14: 191, 15: 210, 16: 103, 17: 71, 18: 241, 19: 109, 20: 215, 21: 216, 22: 2, 23: 72, 24: 19, 25: 144, 26: 20, 27: 32, 28: 178, 29: 172, 30: 81, 31: 82 }, did: 'did:key:z6Mkq5Vr5kEEUF6M8U7AgSKBVppXyNQBoWnyb1vMqedzN3ha', didDocument: { '@context': ['https://www.w3.org/ns/did/v1', 'https://w3id.org/security/suites/ed25519-2020/v1', 'https://w3id.org/security/suites/x25519-2020/v1'], id: 'did:key:z6Mkq5Vr5kEEUF6M8U7AgSKBVppXyNQBoWnyb1vMqedzN3ha', verificationMethod: [{ id: 'did:key:z6Mkq5Vr5kEEUF6M8U7AgSKBVppXyNQBoWnyb1vMqedzN3ha#z6Mkq5Vr5kEEUF6M8U7AgSKBVppXyNQBoWnyb1vMqedzN3ha', type: 'Ed25519VerificationKey2020', controller: 'did:key:z6Mkq5Vr5kEEUF6M8U7AgSKBVppXyNQBoWnyb1vMqedzN3ha', publicKeyMultibase: 'z6Mkq5Vr5kEEUF6M8U7AgSKBVppXyNQBoWnyb1vMqedzN3ha' }], authentication: ['did:key:z6Mkq5Vr5kEEUF6M8U7AgSKBVppXyNQBoWnyb1vMqedzN3ha#z6Mkq5Vr5kEEUF6M8U7AgSKBVppXyNQBoWnyb1vMqedzN3ha'], assertionMethod: ['did:key:z6Mkq5Vr5kEEUF6M8U7AgSKBVppXyNQBoWnyb1vMqedzN3ha#z6Mkq5Vr5kEEUF6M8U7AgSKBVppXyNQBoWnyb1vMqedzN3ha'], capabilityDelegation: ['did:key:z6Mkq5Vr5kEEUF6M8U7AgSKBVppXyNQBoWnyb1vMqedzN3ha#z6Mkq5Vr5kEEUF6M8U7AgSKBVppXyNQBoWnyb1vMqedzN3ha'], capabilityInvocation: ['did:key:z6Mkq5Vr5kEEUF6M8U7AgSKBVppXyNQBoWnyb1vMqedzN3ha#z6Mkq5Vr5kEEUF6M8U7AgSKBVppXyNQBoWnyb1vMqedzN3ha'], keyAgreement: [{ id: 'did:key:z6Mkq5Vr5kEEUF6M8U7AgSKBVppXyNQBoWnyb1vMqedzN3ha#z6LScqycbURGxJztJiSkK6MKZJhujV7PygbA2BHexuriMAdr', type: 'X25519KeyAgreementKey2020', controller: 'did:key:z6Mkq5Vr5kEEUF6M8U7AgSKBVppXyNQBoWnyb1vMqedzN3ha', publicKeyMultibase: 'z6LScqycbURGxJztJiSkK6MKZJhujV7PygbA2BHexuriMAdr' }] } }, [ + 'X-Powered-By', + 'Express', + 'Access-Control-Allow-Origin', + '*', + 'Content-Type', + 'application/json; charset=utf-8', + 'Content-Length', + '1776', + 'ETag', + 'W/"6f0-JdoCppKv4nbnXnQDbZJxlFrXG7o"', + 'Date', + 'Mon, 09 Sep 2024 18:06:31 GMT', + 'Connection', + 'keep-alive', + 'Keep-Alive', + 'timeout=5' + ]) } diff --git a/src/test-fixtures/nocks/did-web-generator.js b/src/test-fixtures/nocks/did-web-generator.js index 142ef22..357ddec 100644 --- a/src/test-fixtures/nocks/did-web-generator.js +++ b/src/test-fixtures/nocks/did-web-generator.js @@ -1,25 +1,24 @@ import nock from 'nock' -export default () => { - - nock('http://localhost:4006', {"encodedQueryParams":true}) - .post('/did-web-generator', {"url":"https://raw.githubusercontent.com/jchartrand/didWebTest/main"}) - .reply(200, {"seed":"z1AhHNg9RSiUrjKAeTLXeYjJG5xE4fyZsxfFwKkXM4PhPMn","decodedSeed":{"0":162,"1":121,"2":218,"3":124,"4":128,"5":83,"6":6,"7":120,"8":155,"9":52,"10":67,"11":214,"12":9,"13":96,"14":98,"15":108,"16":249,"17":187,"18":45,"19":240,"20":184,"21":177,"22":120,"23":176,"24":189,"25":125,"26":247,"27":38,"28":7,"29":64,"30":91,"31":77},"did":"did:web:raw.githubusercontent.com:jchartrand:didWebTest:main","didDocument":{"@context":["https://www.w3.org/ns/did/v1","https://w3id.org/security/suites/ed25519-2020/v1","https://w3id.org/security/suites/x25519-2020/v1"],"id":"did:web:raw.githubusercontent.com:jchartrand:didWebTest:main","assertionMethod":[{"id":"did:web:raw.githubusercontent.com:jchartrand:didWebTest:main#z6Mkoy5dFU7xajPV2QGEif1cz43To6go9Yhtf1T39TXCSMrS","type":"Ed25519VerificationKey2020","controller":"did:web:raw.githubusercontent.com:jchartrand:didWebTest:main","publicKeyMultibase":"z6Mkoy5dFU7xajPV2QGEif1cz43To6go9Yhtf1T39TXCSMrS"}]}}, [ - 'X-Powered-By', - 'Express', - 'Access-Control-Allow-Origin', - '*', - 'Content-Type', - 'application/json; charset=utf-8', - 'Content-Length', - '957', - 'ETag', - 'W/"3bd-+yFc27zaIMTPRG+dm/pWiYDTumc"', - 'Date', - 'Mon, 09 Sep 2024 17:55:01 GMT', - 'Connection', - 'keep-alive', - 'Keep-Alive', - 'timeout=5' -]); +export default () => { + nock('http://localhost:4006', { encodedQueryParams: true }) + .post('/did-web-generator', { url: 'https://raw.githubusercontent.com/jchartrand/didWebTest/main' }) + .reply(200, { seed: 'z1AhHNg9RSiUrjKAeTLXeYjJG5xE4fyZsxfFwKkXM4PhPMn', decodedSeed: { 0: 162, 1: 121, 2: 218, 3: 124, 4: 128, 5: 83, 6: 6, 7: 120, 8: 155, 9: 52, 10: 67, 11: 214, 12: 9, 13: 96, 14: 98, 15: 108, 16: 249, 17: 187, 18: 45, 19: 240, 20: 184, 21: 177, 22: 120, 23: 176, 24: 189, 25: 125, 26: 247, 27: 38, 28: 7, 29: 64, 30: 91, 31: 77 }, did: 'did:web:raw.githubusercontent.com:jchartrand:didWebTest:main', didDocument: { '@context': ['https://www.w3.org/ns/did/v1', 'https://w3id.org/security/suites/ed25519-2020/v1', 'https://w3id.org/security/suites/x25519-2020/v1'], id: 'did:web:raw.githubusercontent.com:jchartrand:didWebTest:main', assertionMethod: [{ id: 'did:web:raw.githubusercontent.com:jchartrand:didWebTest:main#z6Mkoy5dFU7xajPV2QGEif1cz43To6go9Yhtf1T39TXCSMrS', type: 'Ed25519VerificationKey2020', controller: 'did:web:raw.githubusercontent.com:jchartrand:didWebTest:main', publicKeyMultibase: 'z6Mkoy5dFU7xajPV2QGEif1cz43To6go9Yhtf1T39TXCSMrS' }] } }, [ + 'X-Powered-By', + 'Express', + 'Access-Control-Allow-Origin', + '*', + 'Content-Type', + 'application/json; charset=utf-8', + 'Content-Length', + '957', + 'ETag', + 'W/"3bd-+yFc27zaIMTPRG+dm/pWiYDTumc"', + 'Date', + 'Mon, 09 Sep 2024 17:55:01 GMT', + 'Connection', + 'keep-alive', + 'Keep-Alive', + 'timeout=5' + ]) }