Skip to content

Commit 690c566

Browse files
committed
fix code review improvements
1 parent 8d425d8 commit 690c566

36 files changed

+559
-1000
lines changed

tests/cucumber.cjs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
const REPORT_DIR = 'tests/reports';
2+
13
const common = {
24
paths: ['tests/features/**/*.feature'],
35
import: ['tests/step-definitions/**/*.js', 'tests/support/**/*.js'],
@@ -8,11 +10,17 @@ module.exports = {
810
smoke: {
911
...common,
1012
tags: '@smoke',
11-
format: ['./tests/support/pretty-formatter.js', 'html:tests/reports/smoke-report.html'],
13+
format: [
14+
'./tests/support/pretty-formatter.js',
15+
`html:${REPORT_DIR}/smoke-report.html`,
16+
],
1217
},
1318
full: {
1419
...common,
1520
tags: 'not @wip',
16-
format: ['./tests/support/pretty-formatter.js', 'html:tests/reports/full-report.html'],
21+
format: [
22+
'./tests/support/pretty-formatter.js',
23+
`html:${REPORT_DIR}/full-report.html`,
24+
],
1725
},
1826
};

tests/features/assertion/format-graph.feature

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,4 @@ Feature: Assertion Graph Formatting
1919
Then the result should contain a "public" assertion
2020
And the result should contain a "private" assertion
2121
And the private assertion should be a non-empty array
22+

tests/features/asset/asset-allowance.feature

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,23 +19,17 @@ Feature: Token Allowance Management
1919
When I decrease the allowance
2020
Then the allowance operation should complete successfully
2121

22-
Scenario: Set allowance higher than current
23-
Given the current allowance is 100
24-
And a target allowance of 500
22+
Scenario Outline: Set allowance relative to current
23+
Given the current allowance is <current>
24+
And a target allowance of <target>
2525
When I set the allowance
26-
Then the allowance operation should complete successfully
26+
Then <assertion>
2727

28-
Scenario: Set allowance lower than current
29-
Given the current allowance is 500
30-
And a target allowance of 100
31-
When I set the allowance
32-
Then the allowance operation should complete successfully
33-
34-
Scenario: Set allowance equal to current skips transaction
35-
Given the current allowance is 500
36-
And a target allowance of 500
37-
When I set the allowance
38-
Then the result status should indicate "Skipped"
28+
Examples:
29+
| current | target | assertion |
30+
| 100 | 500 | the allowance operation should complete successfully |
31+
| 500 | 100 | the allowance operation should complete successfully |
32+
| 500 | 500 | the result status should indicate "Skipped" |
3933

4034
Scenario: Get current allowance
4135
Given the current allowance is 1000

tests/features/asset/asset-burn.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Feature: Knowledge Asset Burn
88
And the blockchain service is mocked
99

1010
Scenario: Successfully burn an asset
11-
Given a valid UAL "did:dkg:hardhat1:31337/0x5fbdb2315678afecb367f032d93f642f64180aa3/1"
11+
Given a default KC UAL
1212
When I burn the asset
1313
Then the burn should complete successfully
1414
And the result should contain the UAL

tests/features/asset/asset-finality.feature

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,16 @@ Feature: Publish Finality
66
Background:
77
Given the DKG client is initialized with a valid configuration
88
And the node API is mocked
9+
And a default KC UAL
910

10-
Scenario: Asset is finalized with sufficient confirmations
11-
Given a valid UAL "did:dkg:hardhat1:31337/0x5fbdb2315678afecb367f032d93f642f64180aa3/1"
12-
And the node reports 3 finality confirmations
11+
Scenario Outline: Asset finality check
12+
Given the node reports <confirmations> finality confirmations
13+
And the required confirmations are <required>
1314
When I check the publish finality
14-
Then the finality status should be "FINALIZED"
15-
And the number of confirmations should be 3
15+
Then the finality status should be "<status>"
16+
And the number of confirmations should be <confirmations>
1617

17-
Scenario: Asset is not yet finalized
18-
Given a valid UAL "did:dkg:hardhat1:31337/0x5fbdb2315678afecb367f032d93f642f64180aa3/1"
19-
And the node reports 1 finality confirmation
20-
And the required confirmations are 3
21-
When I check the publish finality
22-
Then the finality status should be "NOT FINALIZED"
23-
And the number of confirmations should be 1
18+
Examples:
19+
| confirmations | required | status |
20+
| 3 | 3 | FINALIZED |
21+
| 1 | 3 | NOT FINALIZED |

tests/features/asset/asset-retrieval.feature

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,22 @@ Feature: Knowledge Asset Retrieval
88
Given the DKG client is initialized with a valid configuration
99
And the blockchain service is mocked
1010
And the node API is mocked
11+
And a valid UAL for an existing asset
1112

1213
Scenario: Successfully retrieve an asset by UAL
13-
Given a valid UAL for an existing asset
14-
And the node API get operation returns assertion data
14+
Given the node API get operation returns assertion data
1515
When I get the Knowledge Asset
1616
Then the result should contain the assertion data
1717
And the operation status should be "COMPLETED"
1818

1919
Scenario: Handle asset not found on the network
20-
Given a valid UAL for an existing asset
21-
And the node API get operation returns no assertion
20+
Given the node API get operation returns no assertion
2221
When I get the Knowledge Asset
2322
Then the result should contain a failed get operation
2423
And the error message should contain "Unable to find assertion"
2524

2625
Scenario: Retrieve asset with metadata included
27-
Given a valid UAL for an existing asset
28-
And the node API get operation returns assertion data with metadata
26+
Given the node API get operation returns assertion data with metadata
2927
When I get the Knowledge Asset with metadata included
3028
Then the result should contain the assertion data
3129
And the result should contain metadata

tests/features/asset/asset-transfer.feature

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Feature: Knowledge Asset Transfer
99
And the node API is mocked
1010

1111
Scenario: Successfully transfer an asset to a new owner
12-
Given a valid KA UAL "did:dkg:hardhat1:31337/0x5fbdb2315678afecb367f032d93f642f64180aa3/1/1"
12+
Given a default KA UAL
1313
And a valid new owner address
1414
When I transfer the asset
1515
Then the transfer should complete successfully
@@ -22,7 +22,7 @@ Feature: Knowledge Asset Transfer
2222
Then the operation should fail with a validation error
2323

2424
Scenario: Fail to transfer with missing new owner
25-
Given a valid KA UAL "did:dkg:hardhat1:31337/0x5fbdb2315678afecb367f032d93f642f64180aa3/1/1"
25+
Given a default KA UAL
2626
And no new owner address
2727
When I attempt to transfer the asset
2828
Then the operation should fail with error "newOwner is missing"

tests/features/graph/graph-query.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,6 @@ Feature: Graph Querying
2828

2929
Scenario: Execute a query with paranet UAL scope
3030
Given a valid SPARQL SELECT query
31-
And a Paranet UAL "did:dkg:hardhat1:31337/0x5fbdb2315678afecb367f032d93f642f64180aa3/1/1"
31+
And a default Paranet UAL
3232
When I execute the graph query scoped to the paranet
3333
Then the query should return results

tests/features/graph/local-store.feature

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,9 @@ Feature: Local Store
1212
Given I have content that is neither JSON-LD nor N-Quads
1313
When I attempt to store content locally
1414
Then the local store operation should fail
15+
16+
@wip
17+
Scenario: Local store with valid JSON-LD content
18+
Given I have valid JSON-LD content with public triples
19+
When I attempt to store content locally
20+
Then the operation should complete successfully

tests/features/paranet/paranet-creation.feature

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,23 @@ Feature: Paranet Creation
88
And the blockchain service is mocked
99

1010
Scenario: Successfully create a Paranet
11-
Given a valid KA UAL "did:dkg:hardhat1:31337/0x5fbdb2315678afecb367f032d93f642f64180aa3/1/1"
11+
Given a default KA UAL
1212
When I create a Paranet with name "TestParanet" and description "A test paranet"
1313
Then the Paranet creation should succeed
1414
And the result should contain the paranet UAL
1515

1616
Scenario: Create a Paranet with permissioned node access
17-
Given a valid KA UAL "did:dkg:hardhat1:31337/0x5fbdb2315678afecb367f032d93f642f64180aa3/1/1"
17+
Given a default KA UAL
1818
When I create a Paranet with permissioned nodes access policy
1919
Then the Paranet creation should succeed
2020

2121
Scenario: Fail to create Paranet without KA token ID
22-
Given a valid UAL "did:dkg:hardhat1:31337/0x5fbdb2315678afecb367f032d93f642f64180aa3/1"
22+
Given a default KC UAL
2323
When I attempt to create a Paranet
2424
Then the operation should fail with error "Knowledge asset token id is required"
2525

2626
Scenario: Fail to create Paranet without name
27-
Given a valid KA UAL "did:dkg:hardhat1:31337/0x5fbdb2315678afecb367f032d93f642f64180aa3/1/1"
27+
Given a default KA UAL
2828
When I attempt to create a Paranet without a name
2929
Then the operation should fail with error "paranetName is missing"
3030

0 commit comments

Comments
 (0)