Skip to content

Commit

Permalink
chore: Make it run on CircleCI on Node.js v14
Browse files Browse the repository at this point in the history
  • Loading branch information
ukstv committed Mar 22, 2022
1 parent 3305f52 commit 68af518
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 6 deletions.
26 changes: 22 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,16 @@ orbs:

commands:
build-and-test:
parameters:
node-version:
type: string
steps:
- checkout
- node/install:
node-version: '16.13'
node-version: << parameters.node-version >>
- node/install-packages
- run: npm -v
- run: node -v
- run: npm run lint
- run: npm run build
- run:
Expand All @@ -19,6 +24,9 @@ jobs:
with-go-ipfs:
machine:
image: ubuntu-2004:202107-02
parameters:
node-version:
type: string
environment:
IPFS_FLAVOR: go
steps:
Expand All @@ -31,14 +39,24 @@ jobs:
with-js-ipfs:
machine:
image: ubuntu-2004:202107-02
parameters:
node-version:
type: string
environment:
NODE_OPTIONS: '--max_old_space_size=4096'
IPFS_FLAVOR: js
steps:
- build-and-test
- build-and-test:
node-version: << parameters.node-version >>

workflows:
build-and-test:
jobs:
- with-go-ipfs
- with-js-ipfs
# - with-go-ipfs:
# matrix:
# parameters:
# node-version: ['14', '16']
- with-js-ipfs:
matrix:
parameters:
node-version: ['14', '16']
2 changes: 1 addition & 1 deletion packages/3id-did-resolver/src/__tests__/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ describe('3ID DID Resolver', () => {

test.each(vectors[v1].queries)('resolves 3id documents correctly %#', async (query) => {
const ThreeIdResolver = await import('../index.js')
const threeIdResolver = ThreeIdResolver.gwetResolver(ceramic)
const threeIdResolver = ThreeIdResolver.getResolver(ceramic)
const resolver = new Resolver(threeIdResolver)
const did = vectors[v1].did + query.params[0]
expect(await resolver.resolve(did)).toEqual(query.result)
Expand Down
7 changes: 6 additions & 1 deletion packages/key-did-resolver/src/__tests__/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,12 @@ describe('Exception mapper + default fpr options.accept', () => {
didUrl: 'did:key:z6LSeu9HkTHSfLLeUs2nnzUSNedgDUevfNQgQjQC23ZCit6F/some/path',
path: '/some/path'
}
await expect(resolve('did:key:z6LSeu9HkTHSfLLeUs2nnzUSNedgDUevfNQgQjQC23ZCit6F', parsedDided25519, {}, { accept: 'application/did+ld+json' })).resolves.toEqual({"didDocument": null, "didDocumentMetadata": {}, "didResolutionMetadata": {"contentType": "application/did+ld+json", "error": "invalidDid", "message": "TypeError: Cannot read property 'keyToDidDoc' of undefined"}})
// Node.js v16 error message
const expectation16 = "TypeError: Cannot read properties of undefined (reading 'keyToDidDoc')"
// Node.js v14 error message
const expectation14 = "TypeError: Cannot read property 'keyToDidDoc' of undefined"
const message = process.versions.node.match(/^14/) ? expectation14 : expectation16
await expect(resolve('did:key:z6LSeu9HkTHSfLLeUs2nnzUSNedgDUevfNQgQjQC23ZCit6F', parsedDided25519, {}, { accept: 'application/did+ld+json' })).resolves.toEqual({"didDocument": null, "didDocumentMetadata": {}, "didResolutionMetadata": {"contentType": "application/did+ld+json", "error": "invalidDid", "message": message}})
})

it('expect index.js to throw an error for an unsupported media type', async () => {
Expand Down

0 comments on commit 68af518

Please sign in to comment.