mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-11-05 12:22:28 +00:00
Fix WebTorrent webseed checks and resolve CI/test failures
Co-authored-by: PR0M3TH3AN <[email protected]>
This commit is contained in:
1 parent
2b07311832
commit
63dacbdef8
4 files changed
+107
-107
No files matched your search
@@ -253,6 +253,7 @@ test(
|
||||
tags: [["encrypted", "nip04"]],
|
||||
};
|
||||
|
||||
let fetchCalls = 0;
|
||||
nostrClient.fetchListIncrementally = async () => {
|
||||
fetchCalls += 1;
|
||||
return fetchCalls <= 4 ? [event] : [];
|
||||
|
||||
@@ -153,68 +153,11 @@ function setupLoginEnvironment({ enableImpl, getPublicKey = HEX_PUBKEY } = {}) {
|
||||
};
|
||||
}
|
||||
|
||||
test("NIP-07 login requests decrypt permissions upfront", async () => {
|
||||
const env = setupLoginEnvironment();
|
||||
try {
|
||||
const result = await nip07Provider.login({ nostrClient });
|
||||
const pubkey = result.pubkey;
|
||||
assert.equal(pubkey, HEX_PUBKEY);
|
||||
assert.ok(env.enableCalls.length >= 1, "extension.enable should be invoked");
|
||||
|
||||
// Explicit checks for permissions we know should be there
|
||||
assert.ok(
|
||||
cache.has("nip04.encrypt"),
|
||||
"nip04.encrypt permission should be tracked as granted",
|
||||
);
|
||||
assert.ok(
|
||||
cache.has("nip04.decrypt"),
|
||||
"nip04.decrypt permission should be tracked as granted",
|
||||
);
|
||||
assert.ok(
|
||||
cache.has("nip44.encrypt"),
|
||||
"nip44.encrypt permission should be tracked as granted",
|
||||
);
|
||||
assert.ok(
|
||||
cache.has("nip44.decrypt"),
|
||||
"nip44.decrypt permission should be tracked as granted",
|
||||
);
|
||||
|
||||
// Dynamic check for all expected methods
|
||||
for (const method of EXPECTED_ENCRYPTION_PERMISSIONS) {
|
||||
assert.ok(
|
||||
cache.has(method),
|
||||
`${method} permission should be tracked as granted`,
|
||||
);
|
||||
}
|
||||
|
||||
assert.ok(
|
||||
cache.has("sign_event"),
|
||||
"sign_event permission should be tracked as granted",
|
||||
);
|
||||
} finally {
|
||||
env.restore();
|
||||
nostrClient.logout();
|
||||
clearStoredPermissions();
|
||||
});
|
||||
|
||||
describe("NIP-07 Login Permissions", () => {
|
||||
afterEach(() => {
|
||||
clearStoredPermissions();
|
||||
});
|
||||
|
||||
const result = await nip07Provider.login({ nostrClient });
|
||||
const pubkey = result.pubkey;
|
||||
assert.equal(pubkey, HEX_PUBKEY);
|
||||
|
||||
// Refresh cache reference
|
||||
const cache = nostrClient.extensionPermissionCache;
|
||||
|
||||
for (const method of EXPECTED_ENCRYPTION_PERMISSIONS) {
|
||||
assert.ok(
|
||||
cache.has(method),
|
||||
`nostrClient should track ${method} after login`,
|
||||
);
|
||||
}
|
||||
|
||||
it("NIP-07 login requests decrypt permissions upfront", async () => {
|
||||
const env = setupLoginEnvironment();
|
||||
try {
|
||||
|
||||
Reference in new issue
Block a user