-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
504 additions
and
255 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
open Jest; | ||
|
||
describe("MySql2_id", () => { | ||
describe("toJson", () => | ||
test("it should convert an id to a JSON string", () => | ||
MySql2_id.fromJson(42.0 |. Js.Json.number) | ||
|. MySql2_id.toJson | ||
|. Js.Json.decodeString | ||
|. Belt.Option.getExn | ||
|> Expect.expect | ||
|> Expect.toBe("42") | ||
) | ||
); | ||
|
||
describe("fromJson", () => { | ||
test("should fail when given a JSON boolean", () => { | ||
let fn = () => Js.Json.boolean(true) |. MySql2_id.fromJson; | ||
|
||
Expect.expect(fn) | ||
|> Expect.toThrowMessage("unexpected_identifier_value"); | ||
}); | ||
|
||
test("should fail when given a JSON array", () => { | ||
let fn = () => Js.Json.array([||]) |. MySql2_id.fromJson; | ||
|
||
Expect.expect(fn) | ||
|> Expect.toThrowMessage("unexpected_identifier_value"); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
open Jest; | ||
|
||
describe("MySql2_response", () => | ||
describe("Select", () => { | ||
let test_meta = | ||
Json.Encode.( | ||
object_([ | ||
("catalog", "catalog" |. string), | ||
("schema", "schema" |. string), | ||
("name", "name" |. string), | ||
("orgName", "orgName" |. string), | ||
("table", "table" |. string), | ||
("orgTable", "orgTable" |. string), | ||
("characterSet", 1 |. int), | ||
("columnLength", 2 |. int), | ||
("columnType", 3 |. int), | ||
("flags", 4 |. int), | ||
("decimals", 5 |. int), | ||
]) | ||
); | ||
|
||
describe("count", () => | ||
test("count should return 0 when rows is empty", () => | ||
MySql2_response.Select.make([||], [|test_meta|]) | ||
|. MySql2_response.Select.count | ||
|. Expect.expect | ||
|> Expect.toBe(0) | ||
) | ||
); | ||
}) | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.