mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-11-07 05:13:01 +00:00
chore(ai): add automated PR review report
Co-authored-by: PR0M3TH3AN <[email protected]>
This commit is contained in:
1 parent
c3f96c8819
commit
cfbbf78941
30 files changed
+616
-1765
No files matched your search
@@ -312,13 +312,8 @@ test("NIP-07 login falls back when structured permissions fail", async () => {
|
||||
const result = await nip07Provider.login({ nostrClient });
|
||||
const pubkey = result.pubkey;
|
||||
assert.equal(pubkey, HEX_PUBKEY);
|
||||
assert.ok(env.enableCalls.length >= 3, "should retry with alternate payloads");
|
||||
const [plainCall, objectCall, stringCall] = env.enableCalls;
|
||||
assert.equal(
|
||||
plainCall,
|
||||
undefined,
|
||||
"plain enable() should be attempted first",
|
||||
);
|
||||
assert.ok(env.enableCalls.length >= 2, "should retry with alternate payloads");
|
||||
const [objectCall, stringCall, plainCall] = env.enableCalls;
|
||||
assert.ok(Array.isArray(objectCall?.permissions));
|
||||
assert.equal(
|
||||
typeof objectCall.permissions[0],
|
||||
@@ -331,6 +326,11 @@ test("NIP-07 login falls back when structured permissions fail", async () => {
|
||||
"string",
|
||||
"string-based permissions should be attempted after structured payloads",
|
||||
);
|
||||
assert.equal(
|
||||
plainCall,
|
||||
undefined,
|
||||
"plain enable() should only be attempted if prior payloads fail",
|
||||
);
|
||||
} finally {
|
||||
env.restore();
|
||||
nostrClient.logout();
|
||||
@@ -355,11 +355,23 @@ test("NIP-07 login supports extensions that only allow enable() without payload"
|
||||
assert.equal(pubkey, HEX_PUBKEY);
|
||||
assert.equal(
|
||||
env.enableCalls.length,
|
||||
1,
|
||||
"should succeed with plain enable() immediately",
|
||||
3,
|
||||
"should fall back to plain enable() after payload rejections",
|
||||
);
|
||||
const [plainCall] = env.enableCalls;
|
||||
assert.equal(plainCall, undefined, "first attempt should use plain enable()");
|
||||
const [objectCall, stringCall, plainCall] = env.enableCalls;
|
||||
assert.ok(Array.isArray(objectCall?.permissions));
|
||||
assert.equal(
|
||||
typeof objectCall.permissions[0],
|
||||
"object",
|
||||
"structured permissions should be attempted before falling back",
|
||||
);
|
||||
assert.ok(Array.isArray(stringCall?.permissions));
|
||||
assert.equal(
|
||||
typeof stringCall.permissions[0],
|
||||
"string",
|
||||
"string permissions should be attempted before plain enable()",
|
||||
);
|
||||
assert.equal(plainCall, undefined, "final attempt should use plain enable()");
|
||||
} finally {
|
||||
env.restore();
|
||||
nostrClient.logout();
|
||||
@@ -399,9 +411,8 @@ test("NIP-07 login quickly retries when a permission payload stalls", async () =
|
||||
duration < 500,
|
||||
`login should fall back quickly from stalled enable payloads (duration: ${duration}ms)`,
|
||||
);
|
||||
assert.equal(env.enableCalls.length, 3, "should attempt plain, structured and string payload variants");
|
||||
const [plainCall, objectCall, stringCall] = env.enableCalls;
|
||||
assert.equal(plainCall, undefined);
|
||||
assert.equal(env.enableCalls.length, 2, "should attempt structured and string payload variants");
|
||||
const [objectCall, stringCall] = env.enableCalls;
|
||||
assert.ok(Array.isArray(objectCall?.permissions));
|
||||
assert.equal(typeof objectCall.permissions[0], "object");
|
||||
assert.ok(Array.isArray(stringCall?.permissions));
|
||||
|
||||
Reference in new issue
Block a user