akkounts/spec/features/settings/nostr_spec.rb
Râu Cao 3715cb518b
All checks were successful
continuous-integration/drone/push Build is passing
User Settings: Rename Experiments to Nostr
And use a nostr icon
2024-03-16 16:03:15 +01:00

41 lines
1.2 KiB
Ruby

require 'rails_helper'
RSpec.describe 'Nostr Settings', type: :feature do
let(:user) { create :user, cn: 'jimmy', ou: 'kosmos.org' }
before do
login_as user, scope: :user
end
describe 'Adding a nostr pubkey' do
scenario 'Without nostr browser extension available' do
visit setting_path(:nostr)
expect(page).to have_content("No browser extension found")
expect(page).to have_css('button[data-settings--nostr-pubkey-target=setPubkey]:disabled')
end
# scenario 'Successfully saving a key' do
# Note: Needs a more complex JS testing setup (maybe poltergeist), not
# worth it for now
# end
end
context "With pubkey configured" do
before do
user.update! nostr_pubkey: "07e188a1ff87ce171d517b8ed2bb7a31b1d3453a0db3b15379ec07b724d232f3"
end
scenario 'Remove nostr pubkey from account' do
visit setting_path(:nostr)
expect(page).to have_field("nostr_public_key",
with: "npub1qlsc3g0lsl8pw8230w8d9wm6xxcax3f6pkemz5measrmwfxjxteslf2hac",
disabled: true)
click_link "Remove"
expect(page).to_not have_field("nostr_public_key")
expect(page).to have_content("verify your public key")
expect(user.reload.nostr_pubkey).to be_nil
end
end
end