Skip to content

Commit

Permalink
Use klona over jsonld.clone in all test data.
Browse files Browse the repository at this point in the history
  • Loading branch information
aljones15 committed Dec 7, 2023
1 parent b6fa6d3 commit fdc98f6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions test/10-verify.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
} from '@digitalbazaar/ed25519-verification-key-2018';
import {invalidContexts} from './contexts/index.js';
import jsigs from 'jsonld-signatures';
import jsonld from 'jsonld';
import {klona} from 'klona';
import {mock as mockData} from './mocks/mock.data.js';
import {v4 as uuid} from 'uuid';
import {VeresOneDriver} from 'did-veres-one';
Expand Down Expand Up @@ -629,7 +629,7 @@ for(const [version, mockCredential] of versionedCredentials) {

describe('_checkCredential', () => {
it('should reject a credentialSubject.id that is not a URI', () => {
const credential = jsonld.clone(mockData.credentials.alpha);
const credential = klona(mockData.credentials.alpha);
credential.issuer = 'http://example.edu/credentials/58473';
credential.credentialSubject.id = '12345';
let error;
Expand All @@ -646,7 +646,7 @@ for(const [version, mockCredential] of versionedCredentials) {
});

it('should reject an issuer that is not a URI', () => {
const credential = jsonld.clone(mockData.credentials.alpha);
const credential = klona(mockData.credentials.alpha);
credential.issuer = '12345';
let error;
try {
Expand All @@ -662,7 +662,7 @@ for(const [version, mockCredential] of versionedCredentials) {
});

it('should reject an evidence id that is not a URI', () => {
const credential = jsonld.clone(mockData.credentials.alpha);
const credential = klona(mockData.credentials.alpha);
credential.issuer = 'did:example:12345';
credential.evidence = '12345';
let error;
Expand All @@ -679,7 +679,7 @@ for(const [version, mockCredential] of versionedCredentials) {
});

it('should reject if "expirationDate" has passed', () => {
const credential = jsonld.clone(mockData.credentials.alpha);
const credential = klona(mockData.credentials.alpha);
credential.issuer = 'did:example:12345';
// set expirationDate to an expired date.
credential.expirationDate = '2020-05-31T19:21:25Z';
Expand Down
4 changes: 2 additions & 2 deletions test/testDocumentLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
} from './contexts/index.js';
import dataIntegrityContext from '@digitalbazaar/data-integrity-context';
import jsigs from 'jsonld-signatures';
import jsonld from 'jsonld';
import {klona} from 'klona';
import multikeyContext from '@digitalbazaar/multikey-context';
import {MultiLoader} from './MultiLoader.js';

Expand Down Expand Up @@ -40,7 +40,7 @@ const testDocumentLoader = extendContextLoader(async url => {
if(doc) {
return {
contextUrl: null,
document: jsonld.clone(doc),
document: klona(doc),
documentUrl: url
};
}
Expand Down

0 comments on commit fdc98f6

Please sign in to comment.