Skip to content

feat: support multiple terminal fonts #17257

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 22 commits into from
Apr 7, 2025
Prev Previous commit
Next Next commit
go tests
  • Loading branch information
mtojek committed Apr 4, 2025
commit 9bed6bc668f208f966778a2bab19314d037d0ff3
7 changes: 3 additions & 4 deletions coderd/users_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1972,10 +1972,10 @@
require.NoError(t, err)
}

func TestUserTerminalFont(t *testing.T) {

Check failure on line 1975 in coderd/users_test.go

View workflow job for this annotation

GitHub Actions / lint

TestUserTerminalFont's subtests should call t.Parallel (tparallel)
t.Parallel()

t.Run("valid font", func(t *testing.T) {

Check failure on line 1978 in coderd/users_test.go

View workflow job for this annotation

GitHub Actions / lint

Function TestUserTerminalFont missing the call to method parallel in the test run (paralleltest)
adminClient := coderdtest.New(t, nil)
firstUser := coderdtest.CreateFirstUser(t, adminClient)
client, _ := coderdtest.CreateAnotherUser(t, adminClient, firstUser.OrganizationID)
Expand All @@ -1984,7 +1984,7 @@
defer cancel()

// given
initial, err := client.GetUserAppearanceSettings(ctx, "me")

Check failure on line 1987 in coderd/users_test.go

View workflow job for this annotation

GitHub Actions / lint

ineffectual assignment to err (ineffassign)
require.Equal(t, codersdk.TerminalFontName(""), initial.TerminalFont)

// when
Expand All @@ -1998,7 +1998,7 @@
require.Equal(t, codersdk.TerminalFontFiraCode, updated.TerminalFont)
})

t.Run("unsupported font", func(t *testing.T) {

Check failure on line 2001 in coderd/users_test.go

View workflow job for this annotation

GitHub Actions / lint

Function TestUserTerminalFont missing the call to method parallel in the test run (paralleltest)
adminClient := coderdtest.New(t, nil)
firstUser := coderdtest.CreateFirstUser(t, adminClient)
client, _ := coderdtest.CreateAnotherUser(t, adminClient, firstUser.OrganizationID)
Expand All @@ -2007,7 +2007,7 @@
defer cancel()

// given
initial, err := client.GetUserAppearanceSettings(ctx, "me")

Check failure on line 2010 in coderd/users_test.go

View workflow job for this annotation

GitHub Actions / lint

ineffectual assignment to err (ineffassign)
require.Equal(t, codersdk.TerminalFontName(""), initial.TerminalFont)

// when
Expand All @@ -2020,7 +2020,7 @@
require.Error(t, err)
})

t.Run("empty font is ok", func(t *testing.T) {
t.Run("undefined font is not ok", func(t *testing.T) {

Check failure on line 2023 in coderd/users_test.go

View workflow job for this annotation

GitHub Actions / lint

Function TestUserTerminalFont missing the call to method parallel in the test run (paralleltest)
adminClient := coderdtest.New(t, nil)
firstUser := coderdtest.CreateFirstUser(t, adminClient)
client, _ := coderdtest.CreateAnotherUser(t, adminClient, firstUser.OrganizationID)
Expand All @@ -2029,18 +2029,17 @@
defer cancel()

// given
initial, err := client.GetUserAppearanceSettings(ctx, "me")

Check failure on line 2032 in coderd/users_test.go

View workflow job for this annotation

GitHub Actions / lint

ineffectual assignment to err (ineffassign)
require.Equal(t, codersdk.TerminalFontName(""), initial.TerminalFont)

// when
updated, err := client.UpdateUserAppearanceSettings(ctx, "me", codersdk.UpdateUserAppearanceSettingsRequest{
_, err = client.UpdateUserAppearanceSettings(ctx, "me", codersdk.UpdateUserAppearanceSettingsRequest{
ThemePreference: "light",
TerminalFont: "",
})

// then
require.NoError(t, err)
require.Equal(t, codersdk.TerminalFontName(""), updated.TerminalFont)
require.Error(t, err)
})
}

Expand Down
Loading