From 742efd7dd93fe2aa7e3446077d3dd54457e21de1 Mon Sep 17 00:00:00 2001 From: Vlad Stan Date: Fri, 27 Mar 2026 12:10:51 +0200 Subject: [PATCH] fat: ui --- tests/wallets/index.html | 149 +++++++++++++++++++++++++-------------- 1 file changed, 98 insertions(+), 51 deletions(-) diff --git a/tests/wallets/index.html b/tests/wallets/index.html index f1114930a..3293e7955 100644 --- a/tests/wallets/index.html +++ b/tests/wallets/index.html @@ -958,14 +958,6 @@ min-width: 0; } - .function-content-header { - display: flex; - gap: 12px; - align-items: flex-start; - justify-content: space-between; - margin-bottom: 12px; - } - .test-type-layout { display: grid; gap: 18px; @@ -1330,7 +1322,7 @@
- +
-
- -
-
- {{ currentFundingSource.name }} + {{ currentTestFundingSource.name }} {{ testEntry.variantCount }} generated variants @@ -1474,10 +1456,46 @@
{{ testEntry.expectedError }}
+
- -
+
+ +
+ + + + + +
+
+ +
No wallet-specific mock entry is defined for - {{ currentFundingSource.name }} + {{ currentTestFundingSource.name }} in this test.
@@ -1927,7 +1945,7 @@
-
+
@@ -2115,7 +2133,7 @@
No function-level mocks are defined yet for - {{ currentFundingSource.name }} + {{ currentTestFundingSource.name }} in {{ currentFunction.name }}.
@@ -2722,12 +2740,14 @@ const functionMockDrafts = {} const selectedFunctionByDataset = {} const selectedFundingSourceByDataset = {} + const selectedTestFundingSourceByDataset = {} const settingsDrafts = {} DATASET_DEFS.forEach(def => { datasets[def.key] = createDatasetState(def) selectedFunctionByDataset[def.key] = '' selectedFundingSourceByDataset[def.key] = '' + selectedTestFundingSourceByDataset[def.key] = '' }) return { @@ -2741,6 +2761,7 @@ settingsDraftRowId: 0, settingsDrafts, selectedDatasetKey: 'rest', + selectedTestFundingSourceByDataset, selectedTestTypeByScope: {}, selectedFunctionByDataset, selectedFundingSourceByDataset @@ -2778,6 +2799,18 @@ ) || null ) }, + currentTestFundingSourceName() { + return ( + this.selectedTestFundingSourceByDataset[this.selectedDatasetKey] || '' + ) + }, + currentTestFundingSource() { + return ( + this.currentFundingSources.find( + fs => fs.name === this.currentTestFundingSourceName + ) || null + ) + }, currentFundingSourceSkip: { get() { return Boolean(this.currentFundingSource?.skip) @@ -2837,24 +2870,24 @@ return this.currentDataset.rawText !== this.currentDataset.snapshotText }, currentFunctionBaseMockPath() { - if (!this.currentFunction || !this.currentFundingSource) { + if (!this.currentFunction || !this.currentTestFundingSource) { return '' } return this.baseWalletPath( this.currentFunction.name, - this.currentFundingSource.name + this.currentTestFundingSource.name ) }, currentFunctionMockRows() { - if (!this.currentFunctionName || !this.currentFundingSourceName) { + if (!this.currentFunctionName || !this.currentTestFundingSourceName) { return [] } return this.getFunctionMockDraftRows( this.selectedDatasetKey, this.currentFunctionName, - this.currentFundingSourceName + this.currentTestFundingSourceName ) }, currentFunctionMockNameOptions() { @@ -2876,7 +2909,7 @@ })) }, currentFunctionTestsForFundingSource() { - if (!this.currentFunction || !this.currentFundingSource) { + if (!this.currentFunction || !this.currentTestFundingSource) { return [] } @@ -2889,11 +2922,11 @@ rawHasMocksBlock && Object.prototype.hasOwnProperty.call( test.raw.mocks || {}, - this.currentFundingSource.name + this.currentTestFundingSource.name ) ) const rawWalletMockValue = hasMockEntry - ? test.raw.mocks[this.currentFundingSource.name] + ? test.raw.mocks[this.currentTestFundingSource.name] : undefined const hasExpectField = Object.prototype.hasOwnProperty.call( test.raw || {}, @@ -2908,7 +2941,7 @@ ? this.testWalletPath( this.currentFunction.name, test.index, - this.currentFundingSource.name + this.currentTestFundingSource.name ) : '' const walletMockValueIsArray = Array.isArray(rawWalletMockValue) @@ -2943,7 +2976,7 @@ error: '' })) const variants = testsForFundingSource( - this.currentFundingSource, + this.currentTestFundingSource, this.currentFunction.name, this.currentFunction.raw, test.raw, @@ -2956,7 +2989,7 @@ } let note = '' - if (this.currentFundingSource.skip) { + if (this.currentTestFundingSource.skip) { status = { label: 'Wallet skipped', color: 'warning' @@ -3008,14 +3041,14 @@ }) }, currentTestTypeScopeKey() { - if (!this.currentFunctionName || !this.currentFundingSourceName) { + if (!this.currentFunctionName || !this.currentTestFundingSourceName) { return '' } return [ this.selectedDatasetKey, this.currentFunctionName, - this.currentFundingSourceName + this.currentTestFundingSourceName ].join(':') }, currentFunctionTestTypeGroups() { @@ -3088,6 +3121,8 @@ }, currentFundingSourceName() { this.ensureSettingsDraftForCurrent() + }, + currentTestFundingSourceName() { this.ensureFunctionMockDraftForCurrent() }, currentFunctionName() { @@ -3323,14 +3358,14 @@ ) }, ensureFunctionMockDraftForCurrent(force = false) { - if (!this.currentFunctionName || !this.currentFundingSourceName) { + if (!this.currentFunctionName || !this.currentTestFundingSourceName) { return } this.ensureFunctionMockDraft( this.selectedDatasetKey, this.currentFunctionName, - this.currentFundingSourceName, + this.currentTestFundingSourceName, force ) }, @@ -3504,7 +3539,7 @@ ) }, persistTestMockSet(testEntry, mockSet) { - if (!this.currentFunctionName || !this.currentFundingSourceName) { + if (!this.currentFunctionName || !this.currentTestFundingSourceName) { return } @@ -3621,17 +3656,17 @@ rawTest.mocks = {} } - const walletMockValue = rawTest.mocks[this.currentFundingSourceName] + const walletMockValue = rawTest.mocks[this.currentTestFundingSourceName] if (Array.isArray(walletMockValue) || mockSet.walletMockValueIsArray) { - if (!Array.isArray(rawTest.mocks[this.currentFundingSourceName])) { - rawTest.mocks[this.currentFundingSourceName] = [] + if (!Array.isArray(rawTest.mocks[this.currentTestFundingSourceName])) { + rawTest.mocks[this.currentTestFundingSourceName] = [] } - rawTest.mocks[this.currentFundingSourceName][mockSet.setIndex] = + rawTest.mocks[this.currentTestFundingSourceName][mockSet.setIndex] = nextValue } else { - rawTest.mocks[this.currentFundingSourceName] = nextValue + rawTest.mocks[this.currentTestFundingSourceName] = nextValue } }, { @@ -3739,14 +3774,14 @@ ) }, addFunctionMockRow() { - if (!this.currentFunctionName || !this.currentFundingSourceName) { + if (!this.currentFunctionName || !this.currentTestFundingSourceName) { return } const rows = this.ensureFunctionMockDraft( this.selectedDatasetKey, this.currentFunctionName, - this.currentFundingSourceName + this.currentTestFundingSourceName ) rows.push(this.createFunctionMockDraftRow('', {})) }, @@ -3756,7 +3791,7 @@ this.persistFunctionMocks() }, persistFunctionMocks() { - if (!this.currentFunctionName || !this.currentFundingSourceName) { + if (!this.currentFunctionName || !this.currentTestFundingSourceName) { return } @@ -3795,7 +3830,7 @@ data.functions[this.currentFunctionName].mocks = {} } data.functions[this.currentFunctionName].mocks[ - this.currentFundingSourceName + this.currentTestFundingSourceName ] = nextMocks }, { @@ -3816,6 +3851,7 @@ if (!fundingSources.length) { this.selectedFundingSourceByDataset[datasetKey] = '' + this.selectedTestFundingSourceByDataset[datasetKey] = '' } else { const currentFundingSourceName = this.selectedFundingSourceByDataset[datasetKey] @@ -3827,6 +3863,17 @@ this.selectedFundingSourceByDataset[datasetKey] = fundingSources[0].name } + + const currentTestFundingSourceName = + this.selectedTestFundingSourceByDataset[datasetKey] + const selectedTestFundingSource = fundingSources.find( + fs => fs.name === currentTestFundingSourceName + ) + + if (!selectedTestFundingSource) { + this.selectedTestFundingSourceByDataset[datasetKey] = + fundingSources[0].name + } } if (!functions.length) { @@ -3892,7 +3939,7 @@ this.ensureFunctionMockDraft( datasetKey, this.selectedFunctionByDataset[datasetKey], - this.selectedFundingSourceByDataset[datasetKey], + this.selectedTestFundingSourceByDataset[datasetKey], options.preserveFunctionMockDrafts !== true ) }