Skip to content
Snippets Groups Projects
Unverified Commit 7f6a8220 authored by Emmad Usmani's avatar Emmad Usmani Committed by GitHub
Browse files

Fix order of type checking in `getFieldType` (#28543)

parent 19eb288b
No related branches found
No related tags found
No related merge requests found
...@@ -90,10 +90,10 @@ export function getFieldType(field) { ...@@ -90,10 +90,10 @@ export function getFieldType(field) {
COORDINATE, COORDINATE,
FOREIGN_KEY, FOREIGN_KEY,
PRIMARY_KEY, PRIMARY_KEY,
BOOLEAN,
STRING, STRING,
STRING_LIKE, STRING_LIKE,
NUMBER, NUMBER,
BOOLEAN,
]) { ]) {
if (isFieldType(type, field)) { if (isFieldType(type, field)) {
return type; return type;
......
...@@ -94,6 +94,15 @@ describe("isa", () => { ...@@ -94,6 +94,15 @@ describe("isa", () => {
).toEqual(STRING); ).toEqual(STRING);
}); });
it("should know a bool regardless of semantic_type", () => {
expect(
getFieldType({
base_type: TYPE.Boolean,
semantic_type: TYPE.Category,
}),
).toEqual(BOOLEAN);
});
it("should know what it doesn't know", () => { it("should know what it doesn't know", () => {
expect(getFieldType({ base_type: "DERP DERP DERP" })).toEqual(undefined); expect(getFieldType({ base_type: "DERP DERP DERP" })).toEqual(undefined);
}); });
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment