bruno/packages/bruno-lang/v2/tests/index.spec.js

37 lines
722 B
JavaScript
Raw Normal View History

2023-02-03 00:09:45 +01:00
const parser = require("../src/index");
describe("parser", () => {
it("should parse the bru file", () => {
const input = `
headers {
hello: world
foo: bar
}
script {
function onResponse(request, response) {
expect(response.status).to.equal(200);
}
}
`;
2023-02-03 00:09:45 +01:00
const output = parser(input);
const expected = {
"headers": [
{
"name": "hello",
"value": "world",
"enabled": true
},
{
"name": "foo",
"value": "bar",
"enabled": true
}
],
"script": " function onResponse(request, response) {\n expect(response.status).to.equal(200);\n }"
}
expect(output).toEqual(expected);
2023-02-03 00:09:45 +01:00
});
});