2023-09-21 21:12:48 +02:00
|
|
|
const fs = require('fs');
|
|
|
|
const path = require('path');
|
|
|
|
const bruToJson = require('../src/bruToJson');
|
|
|
|
const jsonToBru = require('../src/jsonToBru');
|
2023-02-03 00:09:45 +01:00
|
|
|
|
2023-09-21 21:12:48 +02:00
|
|
|
describe('bruToJson', () => {
|
|
|
|
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');
|
2023-09-21 21:12:48 +02:00
|
|
|
const expected = require('./fixtures/request.json');
|
2023-02-04 19:57:18 +01:00
|
|
|
const output = bruToJson(input);
|
|
|
|
|
|
|
|
expect(output).toEqual(expected);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2023-09-21 21:12:48 +02:00
|
|
|
describe('jsonToBru', () => {
|
|
|
|
it('should parse the bru file', () => {
|
|
|
|
const input = require('./fixtures/request.json');
|
2023-02-04 19:57:18 +01:00
|
|
|
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
|
|
|
});
|
|
|
|
});
|