mirror of
https://github.com/home-assistant/frontend.git
synced 2025-04-26 14:27:20 +00:00

* Add rspack * Remove TransformAsyncModulesPlugin from rspack * Migrate all webpack usage to rspack * Migrate tests to vitest * Fix test suites * Remove chai dependency * Fix compute_state_display tests * Fix resolveTimeZone * Reduces test pipeline * Revert test ci * optimize chunk filtering * Migrate landing-page to rspack * Update rspack dependencies * Add rsdoctor * Fix prod build bundle size * Use rsdoctor for demo stats * Remove unused webpack configs * Update build-scripts/rspack.cjs Co-authored-by: Petar Petrov <MindFreeze@users.noreply.github.com> * Fix eslint * Update rspack * Remove unused code --------- Co-authored-by: Petar Petrov <MindFreeze@users.noreply.github.com>
38 lines
884 B
TypeScript
38 lines
884 B
TypeScript
import { assert, describe, it } from "vitest";
|
|
|
|
import { hasLocation } from "../../../src/common/entity/has_location";
|
|
|
|
describe("hasLocation", () => {
|
|
it("flags states with location", () => {
|
|
const stateObj: any = {
|
|
attributes: {
|
|
latitude: 12.34,
|
|
longitude: 12.34,
|
|
},
|
|
};
|
|
assert(hasLocation(stateObj));
|
|
});
|
|
it("does not flag states with only latitude", () => {
|
|
const stateObj: any = {
|
|
attributes: {
|
|
latitude: 12.34,
|
|
},
|
|
};
|
|
assert(!hasLocation(stateObj));
|
|
});
|
|
it("does not flag states with only longitude", () => {
|
|
const stateObj: any = {
|
|
attributes: {
|
|
longitude: 12.34,
|
|
},
|
|
};
|
|
assert(!hasLocation(stateObj));
|
|
});
|
|
it("does not flag states with no location", () => {
|
|
const stateObj: any = {
|
|
attributes: {},
|
|
};
|
|
assert(!hasLocation(stateObj));
|
|
});
|
|
});
|