1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-08-02 20:15:22 +02:00

Clarify backend data pipeline naming concepts (importers, processors, materializers, calculators, and syncers) (#2255)
Some checks are pending
Publish Docker image / ci (push) Waiting to run
Publish Docker image / Build docker image (push) Blocked by required conditions

* Rename MarketDataSyncer to MarketDataImporter

* Materializers

* Importers

* More reference replacements
This commit is contained in:
Zach Gollwitzer 2025-05-17 16:37:16 -04:00 committed by GitHub
parent b8903d0980
commit 10f255a9a9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
18 changed files with 165 additions and 163 deletions

View file

@ -1,7 +1,7 @@
require "test_helper"
require "ostruct"
class ExchangeRate::SyncerTest < ActiveSupport::TestCase
class ExchangeRate::ImporterTest < ActiveSupport::TestCase
include ProviderTestHelper
setup do
@ -21,13 +21,13 @@ class ExchangeRate::SyncerTest < ActiveSupport::TestCase
.with(from: "USD", to: "EUR", start_date: get_provider_fetch_start_date(2.days.ago.to_date), end_date: Date.current)
.returns(provider_response)
ExchangeRate::Syncer.new(
ExchangeRate::Importer.new(
exchange_rate_provider: @provider,
from: "USD",
to: "EUR",
start_date: 2.days.ago.to_date,
end_date: Date.current
).sync_provider_rates
).import_provider_rates
db_rates = ExchangeRate.where(from_currency: "USD", to_currency: "EUR", date: 2.days.ago.to_date..Date.current)
.order(:date)
@ -53,13 +53,13 @@ class ExchangeRate::SyncerTest < ActiveSupport::TestCase
.with(from: "USD", to: "EUR", start_date: get_provider_fetch_start_date(1.day.ago.to_date), end_date: Date.current)
.returns(provider_response)
ExchangeRate::Syncer.new(
ExchangeRate::Importer.new(
exchange_rate_provider: @provider,
from: "USD",
to: "EUR",
start_date: 3.days.ago.to_date,
end_date: Date.current
).sync_provider_rates
).import_provider_rates
db_rates = ExchangeRate.order(:date)
assert_equal 4, db_rates.count
@ -75,13 +75,13 @@ class ExchangeRate::SyncerTest < ActiveSupport::TestCase
@provider.expects(:fetch_exchange_rates).never
ExchangeRate::Syncer.new(
ExchangeRate::Importer.new(
exchange_rate_provider: @provider,
from: "USD",
to: "EUR",
start_date: 3.days.ago.to_date,
end_date: Date.current
).sync_provider_rates
).import_provider_rates
end
# A helpful "reset" option for when we need to refresh provider data
@ -103,14 +103,14 @@ class ExchangeRate::SyncerTest < ActiveSupport::TestCase
.with(from: "USD", to: "EUR", start_date: get_provider_fetch_start_date(2.days.ago.to_date), end_date: Date.current)
.returns(provider_response)
ExchangeRate::Syncer.new(
ExchangeRate::Importer.new(
exchange_rate_provider: @provider,
from: "USD",
to: "EUR",
start_date: 2.days.ago.to_date,
end_date: Date.current,
clear_cache: true
).sync_provider_rates
).import_provider_rates
db_rates = ExchangeRate.where(from_currency: "USD", to_currency: "EUR").order(:date)
assert_equal [ 1.3, 1.4, 1.5 ], db_rates.map(&:rate)
@ -129,13 +129,13 @@ class ExchangeRate::SyncerTest < ActiveSupport::TestCase
.with(from: "USD", to: "EUR", start_date: get_provider_fetch_start_date(Date.current), end_date: Date.current)
.returns(provider_response)
ExchangeRate::Syncer.new(
ExchangeRate::Importer.new(
exchange_rate_provider: @provider,
from: "USD",
to: "EUR",
start_date: Date.current,
end_date: future_date
).sync_provider_rates
).import_provider_rates
assert_equal 1, ExchangeRate.count
end