Changeset c8e03c6 in Klonkt for test/gated-settings.test.js
- Timestamp:
- 07/29/2026 10:29:55 AM (6 weeks ago)
- Branches:
- main
- Children:
- 6d5ce0c
- Parents:
- 329873e
- File:
-
- 1 edited
-
test/gated-settings.test.js (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
test/gated-settings.test.js
r329873e rc8e03c6 116 116 117 117 // The forward: B and C are told, A is not asked twice. 118 const told = sent.filter((x) => x.act.object && x.act.object['shaer:feature']).map((x) => x.to).sort(); 119 assert.deepEqual(told, [B, C].sort(), 'both other guardians must receive the proposal'); 118 const fwd = sent.filter((x) => x.act.object && x.act.object['shaer:feature']); 119 assert.deepEqual(fwd.map((x) => x.to).sort(), [B, C].sort(), 'both other guardians must receive the proposal'); 120 // And it must go out AS THE WARD, because the ward's key signs it. Sending 121 // it with the proposer still in `actor` is a signer mismatch: every receiver 122 // answers 401 and the proposal silently never arrives. Live proof, from 123 // beta's log: "guardianship Offer got 401 from boiert.eu/.../inbox". The 124 // first version of this test checked THAT a forward happened and not on 125 // whose behalf, so it passed while nothing worked. 126 for (const x of fwd) { 127 assert.equal(x.act.actor, WARD, 'the forward is signed by the ward, so it must say the ward'); 128 assert.equal(x.act['shaer:proposer'], A, 'and it carries who actually proposed it'); 129 } 120 130 121 131 // B receives its copy on its own server and can answer it. … … 123 133 database.prepare("INSERT OR IGNORE INTO ap_guardianships (slug, role, other_uri, status, offer_id) VALUES ('gb','guardian',?, 'accepted','o')").run(WARD); 124 134 const gbSite = database.prepare('SELECT * FROM sites WHERE slug = ?').get('gb'); 125 assert.equal(await G.handleGuardianshipInbox(gbSite, { ...offer, actor: A, to: ['https://test.example/ap/users/gb'] }), true); 135 // Exactly the shape the ward sends: actor = the ward, proposer alongside. 136 assert.equal(await G.handleGuardianshipInbox(gbSite, { 137 ...offer, actor: WARD, 'shaer:proposer': A, to: ['https://test.example/ap/users/gb'], 138 }), true); 126 139 const review = G.gated.listGatedReviews('gb')[0]; 127 140 assert.ok(review, 'the guardian stores a copy it can answer'); 141 assert.equal(review.proposer, A, 'the screen names who proposed it, not the ward that relayed it'); 128 142 assert.equal(review.feature, 'shaer:externalEmbeds'); 129 143 assert.equal(review.ward_uri, WARD);
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)