|
| 1 | +import chai from 'chai'; |
| 2 | + |
| 3 | +import { |
| 4 | + implementationsWhichSupportVersionAndType, JsonSchemaVersions, VcJsonSchemaTypes, |
| 5 | +} from '../implementations/index.js'; |
| 6 | +import {generateTestResult, checkTestResult, TestResult} from './testutil.js'; |
| 7 | + |
| 8 | +const schemaVersions = Object.keys(JsonSchemaVersions); |
| 9 | +const should = chai.should(); |
| 10 | +schemaVersions.forEach((schemaVersion) => { |
| 11 | + const schemaVersionName = JsonSchemaVersions[schemaVersion]; |
| 12 | + describe(`JsonSchemaCredential – JSON Schema ${schemaVersionName}`, function() { |
| 13 | + const impls = implementationsWhichSupportVersionAndType( |
| 14 | + {version: schemaVersionName, type: VcJsonSchemaTypes.JsonSchemaCredential}); |
| 15 | + const implNames = impls.map((i) => i.name); |
| 16 | + this.matrix = true; |
| 17 | + this.report = true; |
| 18 | + this.implemented = [...implNames]; |
| 19 | + this.rowLabel = 'Test Name'; |
| 20 | + this.columnLabel = 'Implementation'; |
| 21 | + |
| 22 | + // run tests for each impl |
| 23 | + for (const i of impls) { |
| 24 | + describe(i.name, function() { |
| 25 | + it('1 - Passes sanity tests', function() { |
| 26 | + this.test.cell = {columnId: i.name, rowId: this.test.title}; |
| 27 | + generateTestResult(i.name, schemaVersionName, VcJsonSchemaTypes.JsonSchema, '1'); |
| 28 | + const result = checkTestResult(i.name, schemaVersionName, VcJsonSchemaTypes.JsonSchema, '1'); |
| 29 | + should.equal(result, TestResult.success); |
| 30 | + }); |
| 31 | + |
| 32 | + it('2.1 ID - The value MUST be a URL that identifies the schema associated with the verifiable credential.', function() { |
| 33 | + }); |
| 34 | + |
| 35 | + it('2.1 The type property MUST be JsonSchemaCredential.', function() { |
| 36 | + }); |
| 37 | + |
| 38 | + it('3 Implementers MUST provide support for JSON Schema specifications where, in the following table, the required column\'s value is yes', function() { |
| 39 | + }); |
| 40 | + |
| 41 | + it('3.1.1 The $id MUST be present and its value MUST represent a valid URI-reference', function() { |
| 42 | + }); |
| 43 | + |
| 44 | + // NOTE: this also covers the normative guidance in 4 -- Schemas without a $schema property are not considered valid and MUST NOT be processed. |
| 45 | + it('3.1.2, 4 The $schema property MUST be present in each schema', function() { |
| 46 | + }); |
| 47 | + |
| 48 | + it('4 Conformant implementers MUST support JSON Schema specification versions marked as required in the table defined', function() { |
| 49 | + }); |
| 50 | + |
| 51 | + it('4.1 Validation of the integrity of the schema MUST be done before evaluation.', function() { |
| 52 | + |
| 53 | + }); |
| 54 | + |
| 55 | + it('4.2 (Success) Validation MUST result in one of the following three possible outcomes: success, failure, or indeterminate.', function() { |
| 56 | + |
| 57 | + }); |
| 58 | + |
| 59 | + it('4.2 (Failure) Validation MUST result in one of the following three possible outcomes: success, failure, or indeterminate.', function() { |
| 60 | + |
| 61 | + }); |
| 62 | + |
| 63 | + it('4.2 (Indeterminate) Validation MUST result in one of the following three possible outcomes: success, failure, or indeterminate. ' + |
| 64 | + 'Implementers MUST return this outcome when they encounter a schema whose version they do not support.', function() { |
| 65 | + |
| 66 | + }); |
| 67 | + }); |
| 68 | + } |
| 69 | + }); |
| 70 | +}); |
0 commit comments