Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
zihehuang committed Nov 1, 2022
1 parent de98710 commit 6743777
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 12 deletions.
6 changes: 3 additions & 3 deletions lib/go/contracts/internal/assets/assets.go

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions lib/go/templates/internal/assets/assets.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 10 additions & 6 deletions transactions/admin/update_tagline.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,35 @@ import TopShot from 0xTOPSHOTADDRESS
// Parameters:
//
// metadata: A dictionary of all the play metadata associated
// plays: A dictionary of {playID: tagline} pairs
transaction(plays: {UInt32: String}) {

// Local variable for the topshot Admin object
let adminRef: &TopShot.Admin
let firstKey: UInt32
let lastKey: UInt32

prepare(acct: AuthAccount) {

// borrow a reference to the admin resource
self.adminRef = acct.borrow<&TopShot.Admin>(from: /storage/TopShotAdmin)
?? panic("No admin resource in storage")
self.firstKey = plays.keys[0]
self.lastKey = plays.keys[plays.keys.length - 1]
}

execute {
// update a play with the specified metadata
// update multiple plays with the specified metadata
for key in plays.keys {
self.adminRef.updatePlayTagline(playID: key, tagline: plays[key] ?? panic("No tagline for play"))
}
}

post {
for key in plays.keys {
TopShot.getPlayMetaDataByField(playID: key, field: "tagline") != nil:
"tagline doesnt exist"
}
TopShot.getPlayMetaDataByField(playID: self.firstKey, field: "tagline") != nil:
"first play's tagline doesnt exist"
TopShot.getPlayMetaDataByField(playID: self.lastKey, field: "tagline") != nil:
"last play's tagline doesnt exist"
}
}

0 comments on commit 6743777

Please sign in to comment.