refactor: organized v1 and v2 versions inside bru-lang

This commit is contained in:
Anoop M D
2023-02-04 20:11:33 +05:30
parent 86200a8f11
commit d24f1a1054
27 changed files with 262 additions and 245 deletions

View File

@ -0,0 +1,33 @@
const fs = require('fs');
const path = require('path');
const {
bruToEnvJson
} = require('../src');
describe('bruToEnvJson', () => {
it('should parse .bru file contents', () => {
const requestFile = fs.readFileSync(path.join(__dirname, 'fixtures', 'env.bru'), 'utf8');
const result = bruToEnvJson(requestFile);
expect(result).toEqual({
"variables": [{
"enabled": true,
"name": "host",
"value": "https://www.google.com",
"type": "text"
}, {
"enabled": true,
"name": "jwt",
"value": "secret",
"type": "text"
}, {
"enabled": false,
"name": "Content-type",
"value": "application/json",
"type": "text"
}]
});
});
});