2023-02-04 11:41:29 +01:00
|
|
|
const fs = require("fs");
|
|
|
|
const path = require("path");
|
2023-02-04 19:57:18 +01:00
|
|
|
const bruToJson = require("../src/bruToJson");
|
|
|
|
const jsonToBru = require("../src/jsonToBru");
|
2023-02-03 00:09:45 +01:00
|
|
|
|
2023-02-04 19:57:18 +01:00
|
|
|
describe("bruToJson", () => {
|
2023-02-03 16:38:40 +01:00
|
|
|
it("should parse the bru file", () => {
|
2023-02-04 11:41:29 +01:00
|
|
|
const input = fs.readFileSync(path.join(__dirname, 'fixtures', 'request.bru'), 'utf8');
|
|
|
|
const expected = require("./fixtures/request.json");
|
2023-02-04 19:57:18 +01:00
|
|
|
const output = bruToJson(input);
|
|
|
|
|
|
|
|
expect(output).toEqual(expected);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe("jsonToBru", () => {
|
|
|
|
it("should parse the bru file", () => {
|
|
|
|
const input = require("./fixtures/request.json");
|
|
|
|
const expected = fs.readFileSync(path.join(__dirname, 'fixtures', 'request.bru'), 'utf8');
|
|
|
|
const output = jsonToBru(input);
|
2023-02-03 18:57:06 +01:00
|
|
|
|
2023-02-03 16:38:40 +01:00
|
|
|
expect(output).toEqual(expected);
|
2023-02-03 00:09:45 +01:00
|
|
|
});
|
|
|
|
});
|