Skip to content

Commit 4ec06e9

Browse files
committed
test: make check optional when emitting SubgraphUpgraded
1 parent acc3993 commit 4ec06e9

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

test/gns.test.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -219,12 +219,18 @@ describe('GNS', () => {
219219
const tx = gns
220220
.connect(account.signer)
221221
.publishNewVersion(subgraphID, newSubgraph.subgraphDeploymentID, newSubgraph.versionMetadata)
222-
await expect(tx)
223-
.emit(gns, 'SubgraphUpgraded')
224-
.withArgs(subgraphID, newVSignalEstimate, totalAdjustedUp, newSubgraph.subgraphDeploymentID)
222+
const txResult = expect(tx)
225223
.emit(gns, 'SubgraphVersionUpdated')
226224
.withArgs(subgraphID, newSubgraph.subgraphDeploymentID, newSubgraph.versionMetadata)
227225

226+
// Only emits this event if there was actual signal to upgrade
227+
if (beforeSubgraph.nSignal.gt(0)) {
228+
txResult
229+
.emit(gns, 'SubgraphUpgraded')
230+
.withArgs(subgraphID, newVSignalEstimate, totalAdjustedUp, newSubgraph.subgraphDeploymentID)
231+
}
232+
await txResult
233+
228234
// Check curation vSignal old are set to zero
229235
const [afterTokensOldCuration, afterVSignalOldCuration] = await getTokensAndVSignal(
230236
beforeSubgraph.subgraphDeploymentID,

0 commit comments

Comments
 (0)