Skip to content

Commit

Permalink
Improve specs
Browse files Browse the repository at this point in the history
  • Loading branch information
josepjaume committed Jan 16, 2025
1 parent 1c0dfbe commit d1220f1
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { render, screen } from "@testing-library/react"
import { describe, expect, it, vi } from "vitest"
import { I18nProvider, useI18n } from "./i18n-provider"
import { I18nProvider, TranslationsType, useI18n } from "./i18n-provider"

// Test component that uses the i18n hook
function TestComponent() {
Expand All @@ -20,8 +20,8 @@ describe("I18nProvider", () => {
})

it("allows overriding translations", () => {
const customTranslations = {
save: "Guardar",
const customTranslations: TranslationsType = {
save: "Desar",
}

render(
Expand All @@ -30,7 +30,7 @@ describe("I18nProvider", () => {
</I18nProvider>
)

expect(screen.getByTestId("translation")).toHaveTextContent("Guardar")
expect(screen.getByTestId("translation")).toHaveTextContent("Desar")
})

it("throws error when useI18n is used outside provider", () => {
Expand Down

0 comments on commit d1220f1

Please sign in to comment.