jsonld-signatures-merkleproof2019
Version:
A jsonld signature implementation to support MerkleProof2019 verification in Verifiable Credential context
27 lines (23 loc) • 1.2 kB
text/typescript
import { describe, it, expect } from 'vitest';
import { safelyAppendUrlParameter } from '../../src/utils/url';
describe('safelyAppendUrlParameter method', function () {
let fixtureUrl: string;
const fixtureParameterKey = 'parameterKey';
const fixtureParameterValue = 'parameterValue';
describe('given the url already has parameter', function () {
it('should return the url with the parameter correctly appended', function () {
fixtureUrl = 'https://www.domain.tld/path/to/page?key=value';
const assertionURL = `${fixtureUrl}&${fixtureParameterKey}=${fixtureParameterValue}`;
expect(safelyAppendUrlParameter(fixtureUrl, fixtureParameterKey, fixtureParameterValue))
.toEqual(assertionURL);
});
});
describe('given the url does not already have parameter', function () {
it('should return the url with the parameter correctly appended', function () {
fixtureUrl = 'https://www.domain.tld/path/to/page';
const assertionURL = `${fixtureUrl}?${fixtureParameterKey}=${fixtureParameterValue}`;
expect(safelyAppendUrlParameter(fixtureUrl, fixtureParameterKey, fixtureParameterValue))
.toEqual(assertionURL);
});
});
});