mirror of
https://github.com/home-assistant/frontend.git
synced 2025-12-19 18:28:42 +00:00
Use browser default time and number formatting with polyfills if needed (#9481)
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
This commit is contained in:
37
test/common/entity/has_location.test.ts
Normal file
37
test/common/entity/has_location.test.ts
Normal file
@@ -0,0 +1,37 @@
|
||||
import { assert } from "chai";
|
||||
|
||||
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));
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user