Skip to content
This repository has been archived by the owner on Apr 2, 2024. It is now read-only.

Commit

Permalink
Merge pull request #14 from BuxOrg/xpub-remove-private
Browse files Browse the repository at this point in the history
Added test for RemovePrivateData
  • Loading branch information
mergify[bot] authored Feb 17, 2022
2 parents aa7571f + 3783b94 commit f3dec4b
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions model_xpubs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,31 @@ func TestXpub_AfterUpdated(t *testing.T) {
})
}

// TestXpub_RemovePrivateData will test the method RemovePrivateData()
func TestXpub_RemovePrivateData(t *testing.T) {

t.Run("remove private data", func(t *testing.T) {
xPub := newXpub(testXPub, New())
require.NotNil(t, xPub)

xPub.Metadata = Metadata{
"test-key": "test-value",
}
xPub.NextInternalNum = uint32(123)
xPub.NextExternalNum = uint32(321)

assert.NotNil(t, xPub.Metadata)
assert.Equal(t, "test-value", xPub.Metadata["test-key"])
assert.Equal(t, uint32(123), xPub.NextInternalNum)
assert.Equal(t, uint32(321), xPub.NextExternalNum)

xPub.RemovePrivateData()
assert.Nil(t, xPub.Metadata)
assert.Equal(t, uint32(0), xPub.NextInternalNum)
assert.Equal(t, uint32(0), xPub.NextExternalNum)
})
}

// TestXpub_Save will test the method Save()
func (ts *EmbeddedDBTestSuite) TestXpub_Save() {

Expand Down

0 comments on commit f3dec4b

Please sign in to comment.