chore: Refactor RefreshOauthTokenService to improve readability (#8820)

- Added a trait called microsoft_email for the Channel::Email factory.
- Rewrote the logic to make it simple to understand
- Rewrote the specs for readability
This commit is contained in:
Pranav Raj S
2024-01-31 00:24:12 -08:00
committed by GitHub
parent 905ca94f71
commit ee3f734b7b
4 changed files with 130 additions and 69 deletions

View File

@@ -8,5 +8,22 @@ FactoryBot.define do
after(:create) do |channel_email|
create(:inbox, channel: channel_email, account: channel_email.account)
end
trait :microsoft_email do
imap_enabled { true }
imap_address { 'outlook.office365.com' }
imap_port { 993 }
imap_login { 'email@example.com' }
imap_password { '' }
imap_enable_ssl { true }
provider_config do
{
expires_on: Time.zone.now + 3600,
access_token: SecureRandom.hex,
refresh_token: SecureRandom.hex
}
end
provider { 'microsoft' }
end
end
end