flora-exception
Version:
An exception system for FQL.
29 lines (28 loc) • 884 B
JavaScript
import { Add } from "faunadb";
import { FaunaTestDb } from "fauna-test-setup";
import { Fx, Flora } from "../Flora";
import { $Number } from "../FloraTypes";
export const ExceptionSuiteA = () => {
describe("Flora exceptions basic functionality", () => {
let db;
beforeAll(async () => {
db = await FaunaTestDb();
});
test("Composed Add", async () => {
/**
* Adds two numbers.
* @param a
* @param b
* @returns
*/
const ComposedAdd = (a, b) => {
return Fx([[a, $Number], [b, $Number]], $Number, (a, b) => {
return Add(a, b);
});
};
const result = await db.client.query(Flora(ComposedAdd(2, 2)));
expect(result).toBe(4);
});
});
};
ExceptionSuiteA();