hackatime/test/models/user_test.rb
Mahad Kalam 667d3a7c93
WakaTime/Hackatime v1 imports + Settings v2 (#1062)
* Imports are back!!

* Settings UI v3

* Use Inertia forms for heartbeat imports

* Update app/javascript/pages/Users/Settings/Data.svelte

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>

* Update Bundle

* Fix broken Form/Button markup in Data.svelte settings page

* Update JS deps

* Greptile fixes

* Remove dead code

---------

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
2026-03-12 21:27:10 +00:00

60 lines
1.4 KiB
Ruby

require "test_helper"
class UserTest < ActiveSupport::TestCase
test "theme defaults to gruvbox dark" do
user = User.new
assert_equal "gruvbox_dark", user.theme
end
test "theme options include all supported themes in order" do
values = User.theme_options.map { |option| option[:value] }
assert_equal %w[
standard
neon
catppuccin_mocha
catppuccin_iced_latte
gruvbox_dark
github_dark
github_light
nord
rose
rose_pine_dawn
], values
end
test "theme metadata falls back to default for unknown themes" do
metadata = User.theme_metadata("not-a-real-theme")
assert_equal "gruvbox_dark", metadata[:value]
end
test "flipper id uses the user id" do
user = User.create!(timezone: "UTC")
assert_equal "User;#{user.id}", user.flipper_id
end
test "active remote heartbeat import run only counts remote imports" do
user = User.create!(timezone: "UTC")
assert_not user.active_remote_heartbeat_import_run?
user.heartbeat_import_runs.create!(
source_kind: :dev_upload,
state: :queued,
source_filename: "dev.json"
)
assert_not user.active_remote_heartbeat_import_run?
user.heartbeat_import_runs.create!(
source_kind: :wakatime_dump,
state: :waiting_for_dump,
encrypted_api_key: "secret"
)
assert user.active_remote_heartbeat_import_run?
end
end