2023-01-17 23:41:42 +01:00
|
|
|
const fs = require('fs');
|
|
|
|
const path = require('path');
|
|
|
|
|
2023-09-21 21:12:48 +02:00
|
|
|
const { envJsonToBru } = require('../src');
|
2023-01-17 23:41:42 +01:00
|
|
|
|
|
|
|
describe('envJsonToBru', () => {
|
|
|
|
it('should convert json file into .bru file', () => {
|
|
|
|
const env = {
|
2023-09-21 21:12:48 +02:00
|
|
|
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'
|
|
|
|
}
|
|
|
|
]
|
2023-01-17 23:41:42 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
const expectedBruFile = fs.readFileSync(path.join(__dirname, 'fixtures', 'env.bru'), 'utf8');
|
|
|
|
const actualBruFile = envJsonToBru(env);
|
|
|
|
|
|
|
|
expect(expectedBruFile).toEqual(actualBruFile);
|
|
|
|
});
|
|
|
|
});
|