mirror of
https://github.com/we-promise/sure.git
synced 2026-06-08 12:19:03 +00:00
Clarify backend data pipeline naming concepts (importers, processors, materializers, calculators, and syncers) (#2255)
* Rename MarketDataSyncer to MarketDataImporter * Materializers * Importers * More reference replacements
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
require "test_helper"
|
||||
require "ostruct"
|
||||
|
||||
class Security::Price::SyncerTest < ActiveSupport::TestCase
|
||||
class Security::Price::ImporterTest < ActiveSupport::TestCase
|
||||
include ProviderTestHelper
|
||||
|
||||
setup do
|
||||
@@ -23,12 +23,12 @@ class Security::Price::SyncerTest < ActiveSupport::TestCase
|
||||
start_date: get_provider_fetch_start_date(2.days.ago.to_date), end_date: Date.current)
|
||||
.returns(provider_response)
|
||||
|
||||
Security::Price::Syncer.new(
|
||||
Security::Price::Importer.new(
|
||||
security: @security,
|
||||
security_provider: @provider,
|
||||
start_date: 2.days.ago.to_date,
|
||||
end_date: Date.current
|
||||
).sync_provider_prices
|
||||
).import_provider_prices
|
||||
|
||||
db_prices = Security::Price.where(security: @security, date: 2.days.ago.to_date..Date.current).order(:date)
|
||||
|
||||
@@ -52,12 +52,12 @@ class Security::Price::SyncerTest < ActiveSupport::TestCase
|
||||
start_date: get_provider_fetch_start_date(1.day.ago.to_date), end_date: Date.current)
|
||||
.returns(provider_response)
|
||||
|
||||
Security::Price::Syncer.new(
|
||||
Security::Price::Importer.new(
|
||||
security: @security,
|
||||
security_provider: @provider,
|
||||
start_date: 3.days.ago.to_date,
|
||||
end_date: Date.current
|
||||
).sync_provider_prices
|
||||
).import_provider_prices
|
||||
|
||||
db_prices = Security::Price.where(security: @security).order(:date)
|
||||
assert_equal 4, db_prices.count
|
||||
@@ -73,12 +73,12 @@ class Security::Price::SyncerTest < ActiveSupport::TestCase
|
||||
|
||||
@provider.expects(:fetch_security_prices).never
|
||||
|
||||
Security::Price::Syncer.new(
|
||||
Security::Price::Importer.new(
|
||||
security: @security,
|
||||
security_provider: @provider,
|
||||
start_date: 3.days.ago.to_date,
|
||||
end_date: Date.current
|
||||
).sync_provider_prices
|
||||
).import_provider_prices
|
||||
end
|
||||
|
||||
test "full upsert if clear_cache is true" do
|
||||
@@ -100,13 +100,13 @@ class Security::Price::SyncerTest < ActiveSupport::TestCase
|
||||
start_date: get_provider_fetch_start_date(2.days.ago.to_date), end_date: Date.current)
|
||||
.returns(provider_response)
|
||||
|
||||
Security::Price::Syncer.new(
|
||||
Security::Price::Importer.new(
|
||||
security: @security,
|
||||
security_provider: @provider,
|
||||
start_date: 2.days.ago.to_date,
|
||||
end_date: Date.current,
|
||||
clear_cache: true
|
||||
).sync_provider_prices
|
||||
).import_provider_prices
|
||||
|
||||
db_prices = Security::Price.where(security: @security).order(:date)
|
||||
assert_equal [ 150, 155, 160 ], db_prices.map(&:price)
|
||||
@@ -126,12 +126,12 @@ class Security::Price::SyncerTest < ActiveSupport::TestCase
|
||||
start_date: get_provider_fetch_start_date(Date.current), end_date: Date.current)
|
||||
.returns(provider_response)
|
||||
|
||||
Security::Price::Syncer.new(
|
||||
Security::Price::Importer.new(
|
||||
security: @security,
|
||||
security_provider: @provider,
|
||||
start_date: Date.current,
|
||||
end_date: future_date
|
||||
).sync_provider_prices
|
||||
).import_provider_prices
|
||||
|
||||
assert_equal 1, Security::Price.count
|
||||
end
|
||||
Reference in New Issue
Block a user