mirror of
https://github.com/Permissionless-Software-Foundation/psf-memo.git
synced 2026-09-22 17:22:01 -07:00
Spec mute/unmute user (P4.1/P4.2)
Add client, DB, and indexer Gherkin specs for the Memo mute (0x6d16) and unmute (0x6d17) actions. By specifier.
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
# Scenarios: Mute User - 1, Mute User - 2, Mute User - 3, Mute User - 4, Mute User - 5
|
||||
#
|
||||
# The mute/unmute OP_RETURN payload is the target's 20-byte hash160.
|
||||
# Convert the target's cash address with bch-js Address.toHash160() (available
|
||||
# through the minimal-slp-wallet embedded bch-js) before broadcasting 0x6d16 /
|
||||
# 0x6d17. Do not add a separate cashaddr dependency.
|
||||
Feature: Mute User
|
||||
|
||||
Background:
|
||||
Given a wallet authenticated for the address bitcoincash:qqlrzp23w08434twmvr4fxw672whkjy0py26r63g3d
|
||||
Given the wallet has spendable output to pay the transaction fee
|
||||
|
||||
Scenario Outline: Mute User - 1 viewing another user's profile shows a Mute button
|
||||
Given I open the profile page for the address <addr>
|
||||
Then the profile page shows a Mute button
|
||||
|
||||
Examples:
|
||||
| addr |
|
||||
| bitcoincash:qr95sy3j9xwd2ap32xkykttr4cvcu7as4y0qverfuy |
|
||||
| bitcoincash:qqq3728yw0y47sqn6l2na30mcw6zm78dzqre909m2r |
|
||||
|
||||
Scenario Outline: Mute User - 2 clicking Mute broadcasts the mute action and shows Unmute
|
||||
Given I open the profile page for the address <addr>
|
||||
When I click the Mute button
|
||||
Then the app broadcasts an OP_RETURN transaction with the Memo mute prefix for the address <addr>
|
||||
Then the profile page shows an Unmute button
|
||||
|
||||
Examples:
|
||||
| addr |
|
||||
| bitcoincash:qr95sy3j9xwd2ap32xkykttr4cvcu7as4y0qverfuy |
|
||||
|
||||
Scenario Outline: Mute User - 3 clicking Unmute broadcasts the unmute action and shows Mute
|
||||
Given the psf-memo-db API reports that I mute the address <addr>
|
||||
Given I open the profile page for the address <addr>
|
||||
When I click the Unmute button
|
||||
Then the app broadcasts an OP_RETURN transaction with the Memo unmute prefix for the address <addr>
|
||||
Then the profile page shows a Mute button
|
||||
|
||||
Examples:
|
||||
| addr |
|
||||
| bitcoincash:qr95sy3j9xwd2ap32xkykttr4cvcu7as4y0qverfuy |
|
||||
|
||||
Scenario: Mute User - 4 viewing my own profile does not show a Mute button
|
||||
Given I open the profile page for my own address
|
||||
Then the profile page does not show a Mute button
|
||||
|
||||
Scenario Outline: Mute User - 5 the profile page shows Unmute when I already mute the user
|
||||
Given the psf-memo-db API reports that I mute the address <addr>
|
||||
Given I open the profile page for the address <addr>
|
||||
Then the profile page shows an Unmute button
|
||||
|
||||
Examples:
|
||||
| addr |
|
||||
| bitcoincash:qr95sy3j9xwd2ap32xkykttr4cvcu7as4y0qverfuy |
|
||||
| bitcoincash:qqq3728yw0y47sqn6l2na30mcw6zm78dzqre909m2r |
|
||||
@@ -0,0 +1,30 @@
|
||||
# Scenarios: Mute Read - 1, Mute Read - 2
|
||||
#
|
||||
# The mutes store keys mutees by 20-byte hash160. Use bch-js
|
||||
# Address.toHash160() / Address.hash160ToCash() to convert between cash
|
||||
# addresses and hash160 for the mute state and muted-user lists.
|
||||
# Prefer bch-js over adding a separate cashaddr dependency.
|
||||
Feature: Mute Read
|
||||
|
||||
Background:
|
||||
Given a psf-memo-db instance with a mutes store
|
||||
Given the fixture "mutes" is loaded into the mutes store
|
||||
|
||||
Scenario Outline: Mute Read - 1 GET /mute/state reports whether a muter mutes a mutee
|
||||
When the client requests the mute state for muter <muter> and mutee <mutee>
|
||||
Then the mute state reports muted <muted>
|
||||
|
||||
Examples:
|
||||
| muter | mutee | muted |
|
||||
| bitcoincash:qqlrzp23w08434twmvr4fxw672whkjy0py26r63g3d | bitcoincash:qr95sy3j9xwd2ap32xkykttr4cvcu7as4y0qverfuy | true |
|
||||
| bitcoincash:qqlrzp23w08434twmvr4fxw672whkjy0py26r63g3d | bitcoincash:qqq3728yw0y47sqn6l2na30mcw6zm78dzqre909m2r | false |
|
||||
| bitcoincash:qpm2qsznhks23z7629mms6s4cwef74vcwvy22gdx6a | bitcoincash:qr95sy3j9xwd2ap32xkykttr4cvcu7as4y0qverfuy | true |
|
||||
|
||||
Scenario Outline: Mute Read - 2 GET /mute/muted lists the addresses a muter mutes
|
||||
When the client requests the muted list for <muter>
|
||||
Then the muted list contains the addresses <expected>
|
||||
|
||||
Examples:
|
||||
| muter | expected |
|
||||
| bitcoincash:qqlrzp23w08434twmvr4fxw672whkjy0py26r63g3d | bitcoincash:qr95sy3j9xwd2ap32xkykttr4cvcu7as4y0qverfuy |
|
||||
| bitcoincash:qpm2qsznhks23z7629mms6s4cwef74vcwvy22gdx6a | bitcoincash:qr95sy3j9xwd2ap32xkykttr4cvcu7as4y0qverfuy |
|
||||
@@ -0,0 +1,36 @@
|
||||
# Scenarios: Mute Indexer - 1, Mute Indexer - 2, Mute Indexer - 3
|
||||
#
|
||||
# The indexer parses Memo mute actions and stores structured records:
|
||||
# - 0x6d16 mute: target address (20-byte hash160)
|
||||
# - 0x6d17 unmute: target address (20-byte hash160)
|
||||
# The target is a 20-byte P2PKH hash160, like the follow/unfollow payload.
|
||||
Feature: Mute Indexer
|
||||
|
||||
Background:
|
||||
Given a psf-memo-db instance that records mute records
|
||||
Given a psf-memo-indexer configured to write to that database
|
||||
|
||||
Scenario Outline: Mute Indexer - 1 a mute transaction stores the mute record
|
||||
When the indexer processes a mute transaction for the address <addr> from <muter>
|
||||
Then the psf-memo-db stores a mute record for the address <addr> by <muter>
|
||||
|
||||
Examples:
|
||||
| addr | muter |
|
||||
| bitcoincash:qr95sy3j9xwd2ap32xkykttr4cvcu7as4y0qverfuy | bitcoincash:qqlrzp23w08434twmvr4fxw672whkjy0py26r63g3d |
|
||||
| bitcoincash:qqq3728yw0y47sqn6l2na30mcw6zm78dzqre909m2r | bitcoincash:qqlrzp23w08434twmvr4fxw672whkjy0py26r63g3d |
|
||||
|
||||
Scenario Outline: Mute Indexer - 2 an unmute transaction stores the unmute record
|
||||
When the indexer processes an unmute transaction for the address <addr> from <muter>
|
||||
Then the psf-memo-db stores an unmute record for the address <addr> by <muter>
|
||||
|
||||
Examples:
|
||||
| addr | muter |
|
||||
| bitcoincash:qr95sy3j9xwd2ap32xkykttr4cvcu7as4y0qverfuy | bitcoincash:qqlrzp23w08434twmvr4fxw672whkjy0py26r63g3d |
|
||||
|
||||
Scenario Outline: Mute Indexer - 3 a mute transaction with a wrong-size address is rejected
|
||||
When the indexer processes a mute transaction for the address <addr> from <muter>
|
||||
Then the indexer records a process error and stores no mute record
|
||||
|
||||
Examples:
|
||||
| addr | muter |
|
||||
| | bitcoincash:qqlrzp23w08434twmvr4fxw672whkjy0py26r63g3d |
|
||||
Reference in New Issue
Block a user