Skip to content

Commit

Permalink
Use jest toEqual instead of deep-equal
Browse files Browse the repository at this point in the history
  • Loading branch information
clehner authored and msporny committed May 16, 2021
1 parent 9ddb948 commit f387c20
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 13 deletions.
1 change: 0 additions & 1 deletion packages/did-core-test-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
},
"dependencies": {
"base64url": "^3.0.1",
"deep-equal": "^2.0.5",
"fastify": "^3.9.1",
"fastify-cors": "^5.0.0",
"fastify-swagger": "^3.5.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
const deepEqual = require('deep-equal')
const {isXmlDatetime} = require('../utils');

const generateJsonConsumptionTests = (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
const deepEqual = require('deep-equal')

const generateJsonldConsumptionTests = (
{did, didDocumentDataModel, resolutionResult}) => {
const didDocument = {
Expand All @@ -13,7 +11,7 @@ const generateJsonldConsumptionTests = (
'deserialized into the data model according to the JSON ' +
'representation consumption rules as defined in § 6.2 JSON.', async () => {
const consumedDidDocument = JSON.parse(representation);
expect(deepEqual(didDocument, consumedDidDocument)).toBe(true);
expect(didDocument).toEqual(consumedDidDocument);
});
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
const deepEqual = require('deep-equal')
const {isXmlDatetime} = require('../utils');

const generateJsonProductionTests = (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
const deepEqual = require('deep-equal')

const generateJsonldProductionTests = (
{did, didDocumentDataModel, resolutionResult}) => {
const didDocument = {
Expand All @@ -12,7 +10,7 @@ const generateJsonldProductionTests = (
'JSON-LD representation according to the JSON representation production ' +
'rules as defined in § 6.2 JSON.', async () => {
reserializedDidDocument = JSON.parse(JSON.stringify(didDocument));
expect(deepEqual(didDocument, reserializedDidDocument)).toBe(true);
expect(didDocument).toEqual(reserializedDidDocument);
});

it('6.3.1 JSON-LD Production - In addition to using the JSON ' +
Expand All @@ -33,7 +31,7 @@ const generateJsonldProductionTests = (
} else if(Array.isArray(context)) {
expect(context[0]).toBe('https://www.w3.org/ns/did/v1');
reserializedContext = JSON.parse(JSON.stringify(context));
expect(deepEqual(context, reserializedContext)).toBe(true);
expect(context).toEqual(reserializedContext);
} else {
throw new Error('Invalid @context value '+ context);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
const utils = require('../utils');
const jsonMediaTypes = ['application/did+ld+json', 'application/did+json'];
const deepEqual = require('deep-equal')

const generateDidProducerTests = (
{did, didDocumentDataModel, resolutionResult}) => {
Expand All @@ -27,7 +26,7 @@ const generateDidProducerTests = (
if(jsonMediaTypes.includes(contentType)) {
const dataModel = {...dmRse, ...dmProperties};
const parsedDataModel = JSON.parse(representation);
expect(deepEqual(dataModel, parsedDataModel)).toBe(true);
expect(dataModel).toEqual(parsedDataModel);
} else {
throw new Error('Unknown producer for content-type: '+ contentType);
}
Expand All @@ -44,7 +43,7 @@ const generateDidProducerTests = (
if(jsonMediaTypes.includes(contentType)) {
const dataModel = {...dmRse, ...dmProperties};
parsedDataModel = JSON.parse(JSON.stringify(dataModel));
expect(deepEqual(dataModel, parsedDataModel)).toBe(true);
expect(dataModel).toEqual(parsedDataModel);
} else {
throw new Error('Unknown producer for content-type: '+ contentType);
}
Expand Down

0 comments on commit f387c20

Please sign in to comment.