fix: complete location input test options
This commit is contained in:
1 file changed
+5
-6
@@ -7,8 +7,12 @@ import type { Root } from "react-dom/client";
|
|||||||
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||||
|
|
||||||
import { WidgetLocationInput } from "./widget-location-input";
|
import { WidgetLocationInput } from "./widget-location-input";
|
||||||
|
import { optionsBuilder } from "../options";
|
||||||
|
|
||||||
const defaultLocation = { name: "Paris", latitude: 48.8566, longitude: 2.3522 };
|
const defaultLocation = { name: "Paris", latitude: 48.8566, longitude: 2.3522 };
|
||||||
|
const locationOptions = optionsBuilder.from((factory) => ({
|
||||||
|
location: factory.location({ defaultValue: defaultLocation }),
|
||||||
|
})).location;
|
||||||
|
|
||||||
const mocks = vi.hoisted(() => ({
|
const mocks = vi.hoisted(() => ({
|
||||||
values: {} as Record<string, unknown>,
|
values: {} as Record<string, unknown>,
|
||||||
@@ -79,12 +83,7 @@ afterEach(async () => {
|
|||||||
const renderInput = async () => {
|
const renderInput = async () => {
|
||||||
await act(async () => {
|
await act(async () => {
|
||||||
root.render(
|
root.render(
|
||||||
<WidgetLocationInput
|
<WidgetLocationInput kind="weather" property="location" options={locationOptions} initialOptions={{}} />,
|
||||||
kind="weather"
|
|
||||||
property="location"
|
|
||||||
options={{ defaultValue: defaultLocation }}
|
|
||||||
initialOptions={{}}
|
|
||||||
/>,
|
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in new issue
Block a user