2023-02-08 13:47:30 +01:00
|
|
|
/**
|
|
|
|
* This test file is used to test the text parser.
|
|
|
|
*/
|
2023-09-21 21:12:48 +02:00
|
|
|
const parser = require('../src/bruToJson');
|
2023-02-08 13:47:30 +01:00
|
|
|
|
2023-09-21 21:12:48 +02:00
|
|
|
describe('assert parser', () => {
|
|
|
|
it('should parse assert statement', () => {
|
2023-02-08 13:47:30 +01:00
|
|
|
const input = `
|
|
|
|
assert {
|
|
|
|
res("data.airports").filter(a => a.code ==="BLR").name: "Bangalore International Airport"
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
|
|
|
const output = parser(input);
|
|
|
|
const expected = {
|
2023-09-21 21:12:48 +02:00
|
|
|
assertions: [
|
|
|
|
{
|
|
|
|
name: 'res("data.airports").filter(a => a.code ==="BLR").name',
|
|
|
|
value: '"Bangalore International Airport"',
|
|
|
|
enabled: true
|
|
|
|
}
|
|
|
|
]
|
2023-02-08 13:47:30 +01:00
|
|
|
};
|
|
|
|
expect(output).toEqual(expected);
|
|
|
|
});
|
|
|
|
});
|