Skip to content

Commit

Permalink
Merge pull request #287 from tigrisdata/main
Browse files Browse the repository at this point in the history
Beta release
  • Loading branch information
ovaistariq authored Apr 7, 2023
2 parents eede775 + 2d5b30b commit a383538
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 9 deletions.
24 changes: 18 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@
"devDependencies": {
"@semantic-release/npm": "^9.0.1",
"@types/jest": "^28.1.8",
"@types/json-bigint": "^1.0.1",
"@typescript-eslint/eslint-plugin": "^5.35.1",
"@typescript-eslint/parser": "^5.35.1",
"eslint-plugin-tsdoc": "0.2.17",
Expand All @@ -110,7 +111,7 @@
"chalk": "4.1.2",
"dotenv": "^16.0.3",
"google-protobuf": "^3.21.0",
"json-bigint": "^1.0.0",
"json-bigint": "github:sidorares/json-bigint",
"reflect-metadata": "^0.1.13",
"typescript": "^4.7.2",
"app-root-path": "^3.1.0"
Expand Down
9 changes: 7 additions & 2 deletions src/__tests__/tigris.jsonserde.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,28 @@ describe("JSON serde tests", () => {
id: bigint;
name: string;
balance: number;
longitude: number;
}

const user: IUser = {
id: BigInt("9223372036854775807"),
name: "Alice",
balance: 123,
longitude: -73.96340000000001,
};
const userString = Utility.objToJsonString(user);
expect(userString).toBe('{"id":9223372036854775807,"name":"Alice","balance":123}');
expect(userString).toBe(
'{"id":9223372036854775807,"name":"Alice","balance":123,"longitude":-73.96340000000001}'
);

const deserializedUser = Utility.jsonStringToObj<IUser>(
'{"id":9223372036854775807,"name":"Alice","balance":123}',
'{"id":9223372036854775807,"name":"Alice","balance":123,"longitude":-73.96340000000001}',
{ serverUrl: "test" }
);
expect(deserializedUser.id).toBe("9223372036854775807");
expect(deserializedUser.name).toBe("Alice");
expect(deserializedUser.balance).toBe(123);
expect(deserializedUser.longitude).toBe(-73.96340000000001);
});

it("jsonSerDeStringAsBigInt", () => {
Expand Down

0 comments on commit a383538

Please sign in to comment.