const stringify = require('../src/jsonToBru'); describe('jsonToBru stringify', () => { describe('body:ws', () => { it('stringifies a valid bruno request | smoke', () => { const input = { ws: { url: 'ws://localhost:3000', body: 'ws' }, body: { mode: 'ws', ws: [ { content: '{"foo":"bar"}', name: 'message 1', type: 'json' } ] }, settings: { keepAliveInterval: 30, timeout: 250 } }; const output = stringify(input); // generic structure snapshot expect(output).toMatchInlineSnapshot(` "ws { url: ws://localhost:3000 body: ws } body:ws { name: message 1 type: json content: ''' {"foo":"bar"} ''' } settings { keepAliveInterval: 30 timeout: 250 } " `); // Hard check if the input settings were stored as is expect(output).toMatch(new RegExp(`keepAliveInterval: ${input.settings.keepAliveInterval}`)); expect(output).toMatch(new RegExp(`timeout: ${input.settings.timeout}`)); }); }); });