Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(x/ecocredit): add tests for basket events #1408

Merged
merged 7 commits into from
Aug 24, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
style: feature file formatting
  • Loading branch information
tyler authored and tyler committed Aug 24, 2022
commit fdcddc92ada6fa6b0c909b70dab17904e8402404
98 changes: 49 additions & 49 deletions x/ecocredit/server/basket/features/msg_take.feature
Original file line number Diff line number Diff line change
@@ -187,60 +187,60 @@ Feature: Msg/Take

Rule: Events are emitted

Background:
Given a credit type with abbreviation "C" and precision "6"
And a basket with credit type "C" and disable auto retire "true"
And basket token supply amount "2000000"
And Alice's address "regen10z82e5ztmrm4pujgummvmr7aqjzwlp6gz8k8xp"
And Ecocredit module's address "regen1depk54cuajgkzea6zpgkq36tnjwdzv4ak663u6"
And Alice owns basket token amount "2000000"

Scenario: EventTake is emitted
When alice attempts to take credits with basket token amount "2000000"
Then expect event take with properties
"""
{
"owner": "regen10z82e5ztmrm4pujgummvmr7aqjzwlp6gz8k8xp",
"basket_denom": "eco.uC.NCT",
"credits": [
{"batch_denom": "C01-001-20200101-20210101-001", "amount": "2.000000"}
],
"amount": "2000000"
}
"""

Scenario: EventRetire is emitted
When alice attempts to take credits with basket token amount "2000000" and retire on take "true" from "US-WA"
Then expect event retire with properties
"""
{
"owner": "regen10z82e5ztmrm4pujgummvmr7aqjzwlp6gz8k8xp",
"batch_denom": "C01-001-20200101-20210101-001",
"amount": "2.000000",
"jurisdiction": "US-WA"
}
"""

Scenario: EventTransfer is emitted when retire on take is true
When alice attempts to take credits with basket token amount "2000000" and retire on take "true" from "US-WA"
Then expect event transfer with properties
"""
{
"sender": "regen1depk54cuajgkzea6zpgkq36tnjwdzv4ak663u6",
"recipient": "regen10z82e5ztmrm4pujgummvmr7aqjzwlp6gz8k8xp",
"batch_denom": "C01-001-20200101-20210101-001",
"retired_amount": "2.000000"
}
"""
Background:
Given a credit type with abbreviation "C" and precision "6"
And a basket with credit type "C" and disable auto retire "true"
And basket token supply amount "2000000"
And Alice's address "regen10z82e5ztmrm4pujgummvmr7aqjzwlp6gz8k8xp"
And Ecocredit module's address "regen1depk54cuajgkzea6zpgkq36tnjwdzv4ak663u6"
And Alice owns basket token amount "2000000"

Scenario: EventTake is emitted
When alice attempts to take credits with basket token amount "2000000"
Then expect event take with properties
"""
{
"owner": "regen10z82e5ztmrm4pujgummvmr7aqjzwlp6gz8k8xp",
"basket_denom": "eco.uC.NCT",
"credits": [
{"batch_denom": "C01-001-20200101-20210101-001", "amount": "2.000000"}
],
"amount": "2000000"
}
"""

Scenario: EventRetire is emitted
When alice attempts to take credits with basket token amount "2000000" and retire on take "true" from "US-WA"
Then expect event retire with properties
"""
{
"owner": "regen10z82e5ztmrm4pujgummvmr7aqjzwlp6gz8k8xp",
"batch_denom": "C01-001-20200101-20210101-001",
"amount": "2.000000",
"jurisdiction": "US-WA"
}
"""

Scenario: EventTransfer is emitted when retire on take is true
When alice attempts to take credits with basket token amount "2000000" and retire on take "true" from "US-WA"
Then expect event transfer with properties
"""
{
"sender": "regen1depk54cuajgkzea6zpgkq36tnjwdzv4ak663u6",
"recipient": "regen10z82e5ztmrm4pujgummvmr7aqjzwlp6gz8k8xp",
"batch_denom": "C01-001-20200101-20210101-001",
"retired_amount": "2.000000"
}
"""

Scenario: EventTransfer is emitted when retire on take is false
When alice attempts to take credits with basket token amount "2000000" and retire on take "false"
Then expect event transfer with properties
"""
{
"sender": "regen1depk54cuajgkzea6zpgkq36tnjwdzv4ak663u6",
"recipient": "regen10z82e5ztmrm4pujgummvmr7aqjzwlp6gz8k8xp",
"batch_denom": "C01-001-20200101-20210101-001",
"tradable_amount": "2.000000"
"sender": "regen1depk54cuajgkzea6zpgkq36tnjwdzv4ak663u6",
"recipient": "regen10z82e5ztmrm4pujgummvmr7aqjzwlp6gz8k8xp",
"batch_denom": "C01-001-20200101-20210101-001",
"tradable_amount": "2.000000"
}
"""