frontend/test/common/entity/has_location.test.ts
Wendelin bd0bfc1fbe
Rspack (#22807)
* 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>
2024-11-26 14:49:13 +01:00

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));
});
});