Fix some tests

This commit is contained in:
Eugene Burmakin
2025-07-14 21:15:45 +02:00
parent 24378b150d
commit 878d863569
15 changed files with 23 additions and 46 deletions

View File

@@ -19,7 +19,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- Notification about Photon API load is now disabled.
- All distance values are now stored in the database in meters. Conversion to user's preferred unit is done on the fly.
- Every night, Dawarich will try to fetch names for places and visits that don't have them. #1281 #902 #583 #212
- User settings are now being serialized in a more consistent way. `GET /api/v1/users/me` now returns the following data structure:
- ⚠️ User settings are now being serialized in a more consistent way. `GET /api/v1/users/me` now returns the following data structure:
```json
{
"user": {

View File

@@ -1,8 +1,6 @@
# frozen_string_literal: true
class Visits::Suggest
include Rails.application.routes.url_helpers
attr_reader :points, :user, :start_at, :end_at
def initialize(user, start_at:, end_at:)
@@ -14,6 +12,7 @@ class Visits::Suggest
def call
visits = Visits::SmartDetect.new(user, start_at:, end_at:).call
create_visits_notification(user) if visits.any?
return nil unless DawarichSettings.reverse_geocoding_enabled?
@@ -35,7 +34,7 @@ class Visits::Suggest
def create_visits_notification(user)
content = <<~CONTENT
New visits have been suggested based on your location data from #{Time.zone.at(start_at)} to #{Time.zone.at(end_at)}. You can review them on the <a href="#{visits_path}" class="link">Visits</a> page.
New visits have been suggested based on your location data from #{Time.zone.at(start_at)} to #{Time.zone.at(end_at)}. You can review them on the <a href="/visits" class="link">Visits</a> page.
CONTENT
user.notifications.create!(

View File

@@ -27,7 +27,9 @@ RSpec.describe Users::SafeSettings do
photoprism_api_key: nil,
maps: { "distance_unit" => "km" },
distance_unit: 'km',
visits_suggestions_enabled: true
visits_suggestions_enabled: true,
speed_color_scale: nil,
fog_of_war_threshold: nil
}
)
end
@@ -98,7 +100,9 @@ RSpec.describe Users::SafeSettings do
photoprism_api_key: "photoprism-key",
maps: { "name" => "custom", "url" => "https://custom.example.com" },
distance_unit: nil,
visits_suggestions_enabled: false
visits_suggestions_enabled: false,
speed_color_scale: nil,
fog_of_war_threshold: nil
}
)
end

View File

@@ -81,7 +81,7 @@ RSpec.describe Visits::Suggest do
before do
allow(DawarichSettings).to receive(:reverse_geocoding_enabled?).and_return(true)
# Create points for reverse geocoding test in a separate time range
create_visit_points(user, reverse_geocoding_start_at)
clear_enqueued_jobs
end

View File

@@ -29,19 +29,22 @@ describe 'Users API', type: :request do
settings: {
type: :object,
properties: {
immich_url: { type: :string },
route_opacity: { type: :string },
immich_api_key: { type: :string },
live_map_enabled: { type: :boolean },
fog_of_war_meters: { type: :string },
maps: { type: :object },
fog_of_war_meters: { type: :integer },
meters_between_routes: { type: :integer },
preferred_map_layer: { type: :string },
speed_colored_routes: { type: :boolean },
meters_between_routes: { type: :string },
points_rendering_mode: { type: :string },
minutes_between_routes: { type: :string },
time_threshold_minutes: { type: :string },
merge_threshold_minutes: { type: :string },
speed_colored_polylines: { type: :boolean }
minutes_between_routes: { type: :integer },
time_threshold_minutes: { type: :integer },
merge_threshold_minutes: { type: :integer },
live_map_enabled: { type: :boolean },
route_opacity: { type: :number },
immich_url: { type: :string, nullable: true },
photoprism_url: { type: :string, nullable: true },
visits_suggestions_enabled: { type: :boolean },
speed_color_scale: { type: :string, nullable: true },
fog_of_war_threshold: { type: :string, nullable: true }
}
},
admin: { type: :boolean }

View File

@@ -1,5 +0,0 @@
require "test_helper"
class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
driven_by :selenium, using: :chrome, screen_size: [1400, 1400]
end

View File

@@ -1,11 +0,0 @@
require "test_helper"
class ApplicationCable::ConnectionTest < ActionCable::Connection::TestCase
# test "connects with cookies" do
# cookies.signed[:user_id] = 42
#
# connect
#
# assert_equal connection.user_id, "42"
# end
end

View File

View File

View File

View File

View File

View File

View File

View File

@@ -1,13 +0,0 @@
ENV["RAILS_ENV"] ||= "test"
require_relative "../config/environment"
require "rails/test_help"
class ActiveSupport::TestCase
# Run tests in parallel with specified workers
parallelize(workers: :number_of_processors)
# Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
fixtures :all
# Add more helper methods to be used by all tests here...
end