Skip to content

Commit

Permalink
Fixed boolean mapping (#1858)
Browse files Browse the repository at this point in the history
  • Loading branch information
bmingles committed Mar 26, 2024
1 parent 3b7e8e7 commit a46b687
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
4 changes: 3 additions & 1 deletion __mocks__/dh-core.js
Original file line number Diff line number Diff line change
Expand Up @@ -1990,8 +1990,10 @@ class SourceType {
}

class ValueType {
static CHAR = 'CHAR';
static BOOLEAN = 'BOOLEAN';
static DATETIME = 'DATETIME';
static DOUBLE = 'DOUBLE';
static LONG = 'LONG';
static NUMBER = 'NUMBER';
static STRING = 'STRING';
}
Expand Down
7 changes: 3 additions & 4 deletions packages/jsapi-utils/src/TableUtils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -575,10 +575,9 @@ describe('executeAndWaitForEvent', () => {

describe('getValueType', () => {
it.each([
// TODO: Is there a better mapping for boolean?
['boolean', dh.ValueType.STRING],
['java.lang.Boolean', dh.ValueType.STRING],
[TableUtils.dataType.BOOLEAN, dh.ValueType.STRING],
['boolean', dh.ValueType.BOOLEAN],
['java.lang.Boolean', dh.ValueType.BOOLEAN],
[TableUtils.dataType.BOOLEAN, dh.ValueType.BOOLEAN],

['char', dh.ValueType.STRING],
['java.lang.Character', dh.ValueType.STRING],
Expand Down
5 changes: 4 additions & 1 deletion packages/jsapi-utils/src/TableUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -877,7 +877,7 @@ export class TableUtils {
}

/**
* Get the `dh.ValueType` correspoding to the given `dh.Column.type` value.
* Get the `dh.ValueType` corresponding to the given `dh.Column.type` value.
* @param columnType The column type to get the value type for
* @returns The `dh.ValueType` corresponding to the column type
*/
Expand All @@ -889,6 +889,9 @@ export class TableUtils {
const columnDataType = TableUtils.getNormalizedType(columnType);

switch (columnDataType) {
case TableUtils.dataType.BOOLEAN:
return this.dh.ValueType.BOOLEAN;

case TableUtils.dataType.CHAR:
case TableUtils.dataType.STRING:
return this.dh.ValueType.STRING;
Expand Down

0 comments on commit a46b687

Please sign in to comment.