mirror of
https://github.com/Permissionless-Software-Foundation/psf-memo.git
synced 2026-09-21 16:52:01 -07:00
Review mute broadcast result: drop dead modal reset, pin error getter
Remove the unobservable showMuteResultModal reset in ProfilePage._broadcastMute: the flag is set true unconditionally after the awaited broadcast, so no observer can read the reset value. Add unit coverage for getMuteResultError's empty-string contract when there is no result and when a failure carries no message. Record the tool-written mutation and acceptance-mutation manifests. Mutation: 31 killed, 0 survived, 0 uncovered (profile-page.js). CRAP <= 4. DRY clean. Soft Gherkin: 5 intrinsic case-equivalents. By architect.
This commit is contained in:
@@ -1,3 +1,7 @@
|
|||||||
|
# acceptance-mutation-manifest-begin
|
||||||
|
# {"version":1,"tested_at":"2026-09-18T22:26:11.305882913Z","feature_name":"Mute Broadcast Result","feature_path":"/home/trout/work/psf-memo/.worktrees/architect/psf-memo-client/specs/mute-broadcast-result.feature","background_hash":"e1d5f81f1ed083ac6934c429ca3cb4a0f8d4dac44c2eaa45c0960920bde2c017","implementation_hash":"unknown","scenarios":[]}
|
||||||
|
# acceptance-mutation-manifest-end
|
||||||
|
|
||||||
# Scenarios: Mute Broadcast Result - 1, Mute Broadcast Result - 2, Mute Broadcast Result - 3, Mute Broadcast Result - 4
|
# Scenarios: Mute Broadcast Result - 1, Mute Broadcast Result - 2, Mute Broadcast Result - 3, Mute Broadcast Result - 4
|
||||||
#
|
#
|
||||||
# Clicking the Mute button on another user's profile broadcasts a Memo mute
|
# Clicking the Mute button on another user's profile broadcasts a Memo mute
|
||||||
|
|||||||
@@ -123,7 +123,6 @@ class ProfilePage {
|
|||||||
if (!this.memoMute) {
|
if (!this.memoMute) {
|
||||||
throw new Error('Profile page requires a memo mute handler.')
|
throw new Error('Profile page requires a memo mute handler.')
|
||||||
}
|
}
|
||||||
this.showMuteResultModal = false
|
|
||||||
this.lastMuteResult = null
|
this.lastMuteResult = null
|
||||||
try {
|
try {
|
||||||
const { txid } = await this._setMuteState(method, nextState)
|
const { txid } = await this._setMuteState(method, nextState)
|
||||||
@@ -187,5 +186,5 @@ ProfilePage.explorerUrl = blockExplorerTxUrl
|
|||||||
module.exports = ProfilePage
|
module.exports = ProfilePage
|
||||||
|
|
||||||
// mutate4javascript-manifest-begin
|
// mutate4javascript-manifest-begin
|
||||||
// {"version":1,"tested_at":"2026-09-04T17:36:49.028Z","module_hash":"0a1de2d4dc847a50df7d6d1bec9899d61dbe0856a069651f1794384af66aede9","functions":[{"id":"func/ProfilePage.constructor","name":"ProfilePage.constructor","line":17,"end_line":27,"hash":"2a9265aa29bd66a11c2a627ecad5149b093f53b0892b848bef09ac2b949a2ee2"},{"id":"func/ProfilePage.load","name":"ProfilePage.load","line":29,"end_line":45,"hash":"d38c4bec56cac83f0df4975852d915bb6bffc4c566cbcca3a933f31b340b6125"},{"id":"func/ProfilePage._assertReady","name":"ProfilePage._assertReady","line":48,"end_line":55,"hash":"e575f98fa1b492b4c11ae5275459d9f9996df4c566b84c7cae91413c72a02f38"},{"id":"func/ProfilePage._loadState","name":"ProfilePage._loadState","line":59,"end_line":64,"hash":"ab0376720ac75e6fd66d437fbb47a53176d76f681cb13b8794249f2a586549e8"},{"id":"func/ProfilePage.isOwnProfile","name":"ProfilePage.isOwnProfile","line":66,"end_line":68,"hash":"4d149bfe7b183b5d38d496c0a8126d22bd9a919e684f375d66e2c8c1348dd773"},{"id":"func/ProfilePage.canFollow","name":"ProfilePage.canFollow","line":70,"end_line":72,"hash":"0bc2c0c17991d8f1a1d18fba29c901e42633b7cf2c2c8b5747a49e5832d7001d"},{"id":"func/ProfilePage.isFollowing","name":"ProfilePage.isFollowing","line":74,"end_line":76,"hash":"9fc0470db7ffea2da96d2dbbdceff55562e1f7e84377fbb0e8b60d53cc723b40"},{"id":"func/ProfilePage.follow","name":"ProfilePage.follow","line":78,"end_line":80,"hash":"7674b789a9d3c48e0f7a6e553613bac99b2f38449fcdd17faa3c6d7cd2773bdd"},{"id":"func/ProfilePage.unfollow","name":"ProfilePage.unfollow","line":82,"end_line":84,"hash":"69d278b09da1f284be6adacb7264f9c06ac71c42f8e8f1baf9e34d5b24a891fb"},{"id":"func/ProfilePage._setFollowState","name":"ProfilePage._setFollowState","line":87,"end_line":89,"hash":"6cd937862bd6bf18d63fe767724b02ca23d1dc54f71ede23b84b9bde2930200b"},{"id":"func/ProfilePage.canMute","name":"ProfilePage.canMute","line":91,"end_line":93,"hash":"0076ea0e688df292dbe6bcde370aa32937cf7dad674e2168c3395d41b63850af"},{"id":"func/ProfilePage.isMuting","name":"ProfilePage.isMuting","line":95,"end_line":97,"hash":"c4fe9ea0501b7349da39321afd074e7ae48c2c1f2e0d1cfafafbf57f8a05c754"},{"id":"func/ProfilePage.mute","name":"ProfilePage.mute","line":99,"end_line":101,"hash":"228ff6bb19d81e92f99090b6242043b216b9ff8dd9f7aa49d4e50521b1270c26"},{"id":"func/ProfilePage.unmute","name":"ProfilePage.unmute","line":103,"end_line":105,"hash":"ea3e7cbf5a02898ea2a924fb42b683ef50a7a9985ac9118dd404e46fcaa78ed1"},{"id":"func/ProfilePage._setMuteState","name":"ProfilePage._setMuteState","line":108,"end_line":110,"hash":"721536335442a539a8ec7700d9db79abd18cfc24ed451fcd29e198f531d0896f"},{"id":"func/ProfilePage._setState","name":"ProfilePage._setState","line":114,"end_line":121,"hash":"8e01237a2cf48ca49a5c480d94a89cd6fbe3911bd476b17ca826a21bcbd60f4c"},{"id":"func/ProfilePage.getPost","name":"ProfilePage.getPost","line":123,"end_line":125,"hash":"1a6ae1a02b0f79b5b62a2b2324a5f1edbd743bec004fe73cfef7970bead56885"},{"id":"func/ProfilePage.canLoadMore","name":"ProfilePage.canLoadMore","line":127,"end_line":129,"hash":"634983bcc6bbe560daad8326db0dd4bf31d5cb9e45c40112565351dceaf8e5d5"}]}
|
// {"version":1,"tested_at":"2026-09-18T22:22:14.032Z","module_hash":"8075c302b80534f696083176fa519c9cc18069d492800b1317bb89e780d802e4","functions":[{"id":"func/ProfilePage.constructor","name":"ProfilePage.constructor","line":21,"end_line":33,"hash":"5511421482230254af17c6ebf7335207b3908ffa5c93bf086441de4cf64cc25e"},{"id":"func/ProfilePage.load","name":"ProfilePage.load","line":35,"end_line":51,"hash":"d38c4bec56cac83f0df4975852d915bb6bffc4c566cbcca3a933f31b340b6125"},{"id":"func/ProfilePage._assertReady","name":"ProfilePage._assertReady","line":54,"end_line":61,"hash":"e575f98fa1b492b4c11ae5275459d9f9996df4c566b84c7cae91413c72a02f38"},{"id":"func/ProfilePage._loadState","name":"ProfilePage._loadState","line":65,"end_line":70,"hash":"ab0376720ac75e6fd66d437fbb47a53176d76f681cb13b8794249f2a586549e8"},{"id":"func/ProfilePage.isOwnProfile","name":"ProfilePage.isOwnProfile","line":72,"end_line":74,"hash":"4d149bfe7b183b5d38d496c0a8126d22bd9a919e684f375d66e2c8c1348dd773"},{"id":"func/ProfilePage.canFollow","name":"ProfilePage.canFollow","line":76,"end_line":78,"hash":"0bc2c0c17991d8f1a1d18fba29c901e42633b7cf2c2c8b5747a49e5832d7001d"},{"id":"func/ProfilePage.isFollowing","name":"ProfilePage.isFollowing","line":80,"end_line":82,"hash":"9fc0470db7ffea2da96d2dbbdceff55562e1f7e84377fbb0e8b60d53cc723b40"},{"id":"func/ProfilePage.follow","name":"ProfilePage.follow","line":84,"end_line":86,"hash":"7674b789a9d3c48e0f7a6e553613bac99b2f38449fcdd17faa3c6d7cd2773bdd"},{"id":"func/ProfilePage.unfollow","name":"ProfilePage.unfollow","line":88,"end_line":90,"hash":"69d278b09da1f284be6adacb7264f9c06ac71c42f8e8f1baf9e34d5b24a891fb"},{"id":"func/ProfilePage._setFollowState","name":"ProfilePage._setFollowState","line":93,"end_line":95,"hash":"6cd937862bd6bf18d63fe767724b02ca23d1dc54f71ede23b84b9bde2930200b"},{"id":"func/ProfilePage.canMute","name":"ProfilePage.canMute","line":97,"end_line":99,"hash":"0076ea0e688df292dbe6bcde370aa32937cf7dad674e2168c3395d41b63850af"},{"id":"func/ProfilePage.isMuting","name":"ProfilePage.isMuting","line":101,"end_line":103,"hash":"c4fe9ea0501b7349da39321afd074e7ae48c2c1f2e0d1cfafafbf57f8a05c754"},{"id":"func/ProfilePage.mute","name":"ProfilePage.mute","line":105,"end_line":107,"hash":"41f8d8b0c2a63f714875c814edb6c1951f6137ecc191b947f6db2f059c093a93"},{"id":"func/ProfilePage.unmute","name":"ProfilePage.unmute","line":109,"end_line":111,"hash":"95cb63140dbd4a47f8f75a61815c1f0d2e9a8be082af7fe2d06bdaa944b50af9"},{"id":"func/ProfilePage._setMuteState","name":"ProfilePage._setMuteState","line":114,"end_line":116,"hash":"721536335442a539a8ec7700d9db79abd18cfc24ed451fcd29e198f531d0896f"},{"id":"func/ProfilePage._broadcastMute","name":"ProfilePage._broadcastMute","line":122,"end_line":135,"hash":"1054dec2514498c3ccf41dc8c8f8a7c4749107070c4da337ebf8679d9e166e44"},{"id":"func/ProfilePage.getMuteBroadcastMessage","name":"ProfilePage.getMuteBroadcastMessage","line":138,"end_line":141,"hash":"a25c681fc8c0020e3a134dc752d3235319511d4e294ce9d52dab789cbeb1e167"},{"id":"func/ProfilePage.getMuteResultError","name":"ProfilePage.getMuteResultError","line":144,"end_line":147,"hash":"1b6a67a29baa70af8f715de65804dcdab62b23cb3d1d2b80b85255ec09d3c548"},{"id":"func/ProfilePage.explorerUrl","name":"ProfilePage.explorerUrl","line":150,"end_line":152,"hash":"5285656344fdfedeb2abc4eed4fad4d33b2d867c373326c3859c07ff25f84d51"},{"id":"func/ProfilePage.dismissMuteResult","name":"ProfilePage.dismissMuteResult","line":155,"end_line":158,"hash":"2adc077720973bf7309aef0a2c783200313de0928c5e558a8f8c4551c3bb1828"},{"id":"func/ProfilePage._setState","name":"ProfilePage._setState","line":162,"end_line":169,"hash":"0d8a66f50e222dfaee040344c810f63f74a8765343713133e8c872436b2e8c19"},{"id":"func/ProfilePage.getPost","name":"ProfilePage.getPost","line":171,"end_line":173,"hash":"1a6ae1a02b0f79b5b62a2b2324a5f1edbd743bec004fe73cfef7970bead56885"},{"id":"func/ProfilePage.canLoadMore","name":"ProfilePage.canLoadMore","line":175,"end_line":177,"hash":"634983bcc6bbe560daad8326db0dd4bf31d5cb9e45c40112565351dceaf8e5d5"}]}
|
||||||
// mutate4javascript-manifest-end
|
// mutate4javascript-manifest-end
|
||||||
|
|||||||
@@ -188,6 +188,19 @@ test('a failed mute records the error, opens the failure modal, and keeps the Mu
|
|||||||
assert.equal(page.getMuteBroadcastMessage(), '')
|
assert.equal(page.getMuteBroadcastMessage(), '')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
test('getMuteResultError returns an empty string when there is no result', () => {
|
||||||
|
const page = new ProfilePage({ memoDb: makeMemoDb({}) })
|
||||||
|
|
||||||
|
assert.equal(page.getMuteResultError(), '')
|
||||||
|
})
|
||||||
|
|
||||||
|
test('getMuteResultError returns an empty string for a failure with no message', () => {
|
||||||
|
const page = new ProfilePage({ memoDb: makeMemoDb({}) })
|
||||||
|
page.lastMuteResult = { ok: false, action: 'mute' }
|
||||||
|
|
||||||
|
assert.equal(page.getMuteResultError(), '')
|
||||||
|
})
|
||||||
|
|
||||||
test('dismissing the mute result closes the modal without changing the button state', async () => {
|
test('dismissing the mute result closes the modal without changing the button state', async () => {
|
||||||
const myAddr = 'bitcoincash:qqlrzp23w08434twmvr4fxw672whkjy0py26r63g3d'
|
const myAddr = 'bitcoincash:qqlrzp23w08434twmvr4fxw672whkjy0py26r63g3d'
|
||||||
const addr = 'bitcoincash:qr95sy3j9xwd2ap32xkykttr4cvcu7as4y0qverfuy'
|
const addr = 'bitcoincash:qr95sy3j9xwd2ap32xkykttr4cvcu7as4y0qverfuy'
|
||||||
|
|||||||
Reference in New Issue
Block a user