Skip to content

Commit

Permalink
TestSetCollectionExternalUrl (#36)
Browse files Browse the repository at this point in the history
Do we want to test that the url is what we expect? Or is this sufficient

Edit: above is included in test now

---------

Co-authored-by: ash <[email protected]>
  • Loading branch information
web3ashlee and ash authored Dec 21, 2023
1 parent 934776c commit 216e369
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
5 changes: 5 additions & 0 deletions scripts/get_collection_external_url.cdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import "FlowtyWrapped"

pub fun main(): String {
return FlowtyWrapped.collectionExternalUrl
}
10 changes: 10 additions & 0 deletions test/FlowtyWrapped_tests.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,16 @@ pub fun testGetRaffleManager() {
scriptExecutor("raffle/borrow_raffle_manager.cdc", [rafflesAcct.address])
}

pub fun testSetCollectionExternalUrl() {
let baseHtmlUrl: String = "https://flowty.io/asset/0x0000000000000007/FlowtyWrappedTEST"

txExecutor("set_collection_external_url.cdc", [rafflesAcct], [baseHtmlUrl], nil)

let result = scriptExecutor("get_collection_external_url.cdc", [])
let castedResult = result! as! String
assert(castedResult == baseHtmlUrl, message: "baseHtmlUrl does not match expected")
}

pub fun testMint() {
let acct = Test.createAccount()
let username: String = "user1"
Expand Down
15 changes: 15 additions & 0 deletions transactions/set_collection_external_url.cdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import "FlowtyWrapped"


transaction(url: String) {
let admin: &FlowtyWrapped.Admin

prepare(acct: AuthAccount) {
self.admin = acct.borrow<&FlowtyWrapped.Admin>(from: FlowtyWrapped.AdminStoragePath)
?? panic("Could not borrow a reference to the NFT minter")
}

execute {
self.admin.setCollectionExternalUrl(url)
}
}

0 comments on commit 216e369

Please sign in to comment.