Skip to content
This repository has been archived by the owner on Dec 12, 2024. It is now read-only.

Add web5 spec filters #19

Merged
merged 4 commits into from
Aug 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/actions/specs-report/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ GitHub Action to Parse and Generate tbd Specs Reports
with:
junit-report-paths: packages/*/results.xml # Glob Path with the JUnit test vectors report
spec-path: tbdex # relative path to the tbd spec submodule folder
suite-name-regex: TbdexTestVector # regex to filter the test suites names
feature-regex: TbdexTestVectors(\w+) # regex to extract the spec feature from the test suite name
vector-regex: TbdexTestVectors(\w+) (\w+) # regex to extract the spec vector from the test suite name
fail-on-missing-vectors: true # if false, it will not fail the build if the test vectors are missing
fail-on-failed-test-cases: true # if false, it will not fail the build if the test cases are failed
comment-on-pr: true # if true, it will comment on the PR with the report
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

162 changes: 162 additions & 0 deletions .github/actions/specs-report/__tests__/assets/web5-swift-tests.xml

Large diffs are not rendered by default.

9 changes: 6 additions & 3 deletions .github/actions/specs-report/__tests__/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ const defaultGetInputMockImplementation = (): void => {
switch (name) {
case 'junit-report-paths':
return '500'
case 'suite-name-regex':
return 'TbdexTestVector' // or 'Web5TestVector' for Web5
case 'feature-regex':
return 'TbdexTestVectors(\\w+)'
case 'vector-regex':
return 'TbdexTestVectors(\\w+) (\\w+)'
case 'spec-path':
return '500'
case 'git-token':
Expand Down Expand Up @@ -122,7 +128,6 @@ describe('action', () => {
specSkippedTestCases: 0,
...SUCCESS_MOCK.vectors
}
console.info(output['test-vector-report'])
const testVectorReport = JSON.parse(output['test-vector-report'])
expect(testVectorReport).toEqual(expectedReport)
})
Expand All @@ -144,7 +149,6 @@ describe('action', () => {
expect(junitParseMock).toHaveReturnedTimes(1)
expect(junitParseMock).toHaveBeenCalledWith(rawJunitFile)

console.info({ output })
expect(setOutputMock).toHaveBeenCalled()
expect(output.success).not.toBeDefined()
expect(setFailedMock).toHaveBeenCalledWith('❌ Failed test vectors found')
Expand All @@ -165,7 +169,6 @@ describe('action', () => {
specSkippedTestCases: 0,
...FAILURE_MOCK.vectors
}
console.info(output['test-vector-report'])
const testVectorReport = JSON.parse(output['test-vector-report'])
expect(testVectorReport).toEqual(expectedReport)
})
Expand Down
67 changes: 47 additions & 20 deletions .github/actions/specs-report/__tests__/mocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const SUCCESS_MOCK = {
skippedVectors: [],
successVectors: [
{
category: 'protocol',
feature: 'Protocol',
name: 'parse_balance',
file: '/home/runner/work/tbdex-js/tbdex-js/tbdex/hosted/test-vectors/protocol/vectors/parse-balance.json',
testCases: [
Expand All @@ -31,7 +31,7 @@ export const SUCCESS_MOCK = {
]
},
{
category: 'protocol',
feature: 'Protocol',
name: 'parse_cancel',
file: '/home/runner/work/tbdex-js/tbdex-js/tbdex/hosted/test-vectors/protocol/vectors/parse-cancel.json',
testCases: [
Expand All @@ -43,7 +43,7 @@ export const SUCCESS_MOCK = {
]
},
{
category: 'protocol',
feature: 'Protocol',
name: 'parse_close',
file: '/home/runner/work/tbdex-js/tbdex-js/tbdex/hosted/test-vectors/protocol/vectors/parse-close.json',
testCases: [
Expand All @@ -55,7 +55,7 @@ export const SUCCESS_MOCK = {
]
},
{
category: 'protocol',
feature: 'Protocol',
name: 'parse_offering',
file: '/home/runner/work/tbdex-js/tbdex-js/tbdex/hosted/test-vectors/protocol/vectors/parse-offering.json',
testCases: [
Expand All @@ -67,7 +67,7 @@ export const SUCCESS_MOCK = {
]
},
{
category: 'protocol',
feature: 'Protocol',
name: 'parse_order',
file: '/home/runner/work/tbdex-js/tbdex-js/tbdex/hosted/test-vectors/protocol/vectors/parse-order.json',
testCases: [
Expand All @@ -79,7 +79,7 @@ export const SUCCESS_MOCK = {
]
},
{
category: 'protocol',
feature: 'Protocol',
name: 'parse_orderinstructions',
file: '/home/runner/work/tbdex-js/tbdex-js/tbdex/hosted/test-vectors/protocol/vectors/parse-orderinstructions.json',
testCases: [
Expand All @@ -91,7 +91,7 @@ export const SUCCESS_MOCK = {
]
},
{
category: 'protocol',
feature: 'Protocol',
name: 'parse_orderstatus',
file: '/home/runner/work/tbdex-js/tbdex-js/tbdex/hosted/test-vectors/protocol/vectors/parse-orderstatus.json',
testCases: [
Expand All @@ -103,7 +103,7 @@ export const SUCCESS_MOCK = {
]
},
{
category: 'protocol',
feature: 'Protocol',
name: 'parse_quote',
file: '/home/runner/work/tbdex-js/tbdex-js/tbdex/hosted/test-vectors/protocol/vectors/parse-quote.json',
testCases: [
Expand All @@ -115,7 +115,7 @@ export const SUCCESS_MOCK = {
]
},
{
category: 'protocol',
feature: 'Protocol',
name: 'parse_rfq_omit_private_data',
file: '/home/runner/work/tbdex-js/tbdex-js/tbdex/hosted/test-vectors/protocol/vectors/parse-rfq-omit-private-data.json',
testCases: [
Expand All @@ -127,7 +127,7 @@ export const SUCCESS_MOCK = {
]
},
{
category: 'protocol',
feature: 'Protocol',
name: 'parse_rfq',
file: '/home/runner/work/tbdex-js/tbdex-js/tbdex/hosted/test-vectors/protocol/vectors/parse-rfq.json',
testCases: [
Expand All @@ -147,21 +147,21 @@ export const FAILURE_MOCK = {
vectors: {
missingVectors: [
{
category: 'protocol',
feature: 'Protocol',
name: 'parse_close',
file: '/home/runner/work/tbdex-js/tbdex-js/tbdex/hosted/test-vectors/protocol/vectors/parse-close.json',
testCases: []
},
{
category: 'protocol',
feature: 'Protocol',
name: 'parse_offering',
file: '/home/runner/work/tbdex-js/tbdex-js/tbdex/hosted/test-vectors/protocol/vectors/parse-offering.json',
testCases: []
}
],
failedVectors: [
{
category: 'protocol',
feature: 'Protocol',
name: 'parse_cancel',
file: '/home/runner/work/tbdex-js/tbdex-js/tbdex/hosted/test-vectors/protocol/vectors/parse-cancel.json',
testCases: [
Expand All @@ -184,7 +184,7 @@ export const FAILURE_MOCK = {
skippedVectors: [],
successVectors: [
{
category: 'protocol',
feature: 'Protocol',
name: 'parse_balance',
file: '/home/runner/work/tbdex-js/tbdex-js/tbdex/hosted/test-vectors/protocol/vectors/parse-balance.json',
testCases: [
Expand All @@ -196,7 +196,7 @@ export const FAILURE_MOCK = {
]
},
{
category: 'protocol',
feature: 'Protocol',
name: 'parse_order',
file: '/home/runner/work/tbdex-js/tbdex-js/tbdex/hosted/test-vectors/protocol/vectors/parse-order.json',
testCases: [
Expand All @@ -208,7 +208,7 @@ export const FAILURE_MOCK = {
]
},
{
category: 'protocol',
feature: 'Protocol',
name: 'parse_orderinstructions',
file: '/home/runner/work/tbdex-js/tbdex-js/tbdex/hosted/test-vectors/protocol/vectors/parse-orderinstructions.json',
testCases: [
Expand All @@ -220,7 +220,7 @@ export const FAILURE_MOCK = {
]
},
{
category: 'protocol',
feature: 'Protocol',
name: 'parse_orderstatus',
file: '/home/runner/work/tbdex-js/tbdex-js/tbdex/hosted/test-vectors/protocol/vectors/parse-orderstatus.json',
testCases: [
Expand All @@ -232,7 +232,7 @@ export const FAILURE_MOCK = {
]
},
{
category: 'protocol',
feature: 'Protocol',
name: 'parse_quote',
file: '/home/runner/work/tbdex-js/tbdex-js/tbdex/hosted/test-vectors/protocol/vectors/parse-quote.json',
testCases: [
Expand All @@ -244,7 +244,7 @@ export const FAILURE_MOCK = {
]
},
{
category: 'protocol',
feature: 'Protocol',
name: 'parse_rfq_omit_private_data',
file: '/home/runner/work/tbdex-js/tbdex-js/tbdex/hosted/test-vectors/protocol/vectors/parse-rfq-omit-private-data.json',
testCases: [
Expand All @@ -256,7 +256,7 @@ export const FAILURE_MOCK = {
]
},
{
category: 'protocol',
feature: 'Protocol',
name: 'parse_rfq',
file: '/home/runner/work/tbdex-js/tbdex-js/tbdex/hosted/test-vectors/protocol/vectors/parse-rfq.json',
testCases: [
Expand All @@ -270,3 +270,30 @@ export const FAILURE_MOCK = {
]
}
}

export const WEB5_KT_JUNIT_FILES = [
`${__dirname}/assets/web5-kt-web5.sdk.credentials.Web5TestVectorsCredentials.xml`,
`${__dirname}/assets/web5-kt-web5.sdk.credentials.Web5TestVectorsPresentationExchange.xml`
]

export const WEB5_TEST_VECTORS_FILES = [
'/home/runner/work/web5-kt/web5-kt/web5-spec/test-vectors/credentials/create.json',
'/home/runner/work/web5-kt/web5-kt/web5-spec/test-vectors/credentials/verify.json',
'/home/runner/work/web5-kt/web5-kt/web5-spec/test-vectors/crypto_ed25519/sign.json',
'/home/runner/work/web5-kt/web5-kt/web5-spec/test-vectors/crypto_ed25519/verify.json',
'/home/runner/work/web5-kt/web5-kt/web5-spec/test-vectors/crypto_es256k/sign.json',
'/home/runner/work/web5-kt/web5-kt/web5-spec/test-vectors/crypto_es256k/verify.json',
'/home/runner/work/web5-kt/web5-kt/web5-spec/test-vectors/did_dht/create.json',
'/home/runner/work/web5-kt/web5-kt/web5-spec/test-vectors/did_dht/resolve.json',
'/home/runner/work/web5-kt/web5-kt/web5-spec/test-vectors/did_jwk/resolve.json',
'/home/runner/work/web5-kt/web5-kt/web5-spec/test-vectors/did_web/resolve.json',
'/home/runner/work/web5-kt/web5-kt/web5-spec/test-vectors/portable_did/parse.json',
'/home/runner/work/web5-kt/web5-kt/web5-spec/test-vectors/presentation_exchange/create_presentation_from_credentials.json',
'/home/runner/work/web5-kt/web5-kt/web5-spec/test-vectors/presentation_exchange/evaluate_presentation.json',
'/home/runner/work/web5-kt/web5-kt/web5-spec/test-vectors/presentation_exchange/select_credentials.json',
'/home/runner/work/web5-kt/web5-kt/web5-spec/test-vectors/presentation_exchange/validate_definition.json',
'/home/runner/work/web5-kt/web5-kt/web5-spec/test-vectors/presentation_exchange/validate_submission.json',
'/home/runner/work/web5-kt/web5-kt/web5-spec/test-vectors/vc_jwt/decode.json',
'/home/runner/work/web5-kt/web5-kt/web5-spec/test-vectors/vc_jwt/verify.json',
'/home/runner/work/web5-kt/web5-kt/web5-spec/test-vectors/vectors.schema.json'
]
Loading
Loading