2018-03-26 23:25:36 +02:00
|
|
|
/**
|
|
|
|
* BSON tests.
|
|
|
|
*
|
|
|
|
* @author n1474335 [n1474335@gmail.com]
|
|
|
|
*
|
|
|
|
* @copyright Crown Copyright 2018
|
|
|
|
* @license Apache-2.0
|
|
|
|
*/
|
2018-05-17 17:34:00 +02:00
|
|
|
import TestRegister from "../../TestRegister";
|
2018-03-26 23:25:36 +02:00
|
|
|
|
|
|
|
TestRegister.addTests([
|
|
|
|
{
|
|
|
|
name: "BSON serialise: nothing",
|
|
|
|
input: "",
|
|
|
|
expectedOutput: "",
|
|
|
|
recipeConfig: [
|
|
|
|
{
|
|
|
|
op: "BSON serialise",
|
|
|
|
args: [],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "BSON serialise: basic",
|
|
|
|
input: "{\"hello\":\"world\"}",
|
|
|
|
expectedOutput: "\x16\x00\x00\x00\x02hello\x00\x06\x00\x00\x00world\x00\x00",
|
|
|
|
recipeConfig: [
|
|
|
|
{
|
|
|
|
op: "BSON serialise",
|
|
|
|
args: [],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "BSON deserialise: nothing",
|
|
|
|
input: "",
|
|
|
|
expectedOutput: "",
|
|
|
|
recipeConfig: [
|
|
|
|
{
|
|
|
|
op: "BSON deserialise",
|
|
|
|
args: [],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "BSON deserialise: basic",
|
|
|
|
input: "\x16\x00\x00\x00\x02hello\x00\x06\x00\x00\x00world\x00\x00",
|
|
|
|
expectedOutput: "{\n \"hello\": \"world\"\n}",
|
|
|
|
recipeConfig: [
|
|
|
|
{
|
|
|
|
op: "BSON deserialise",
|
|
|
|
args: [],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
]);
|