import {createLogLineMessage, parseLogLineCommand} from './RepoActionView.vue';
test('LogLineMessage', () => {
const cases = {
'normal message': 'normal message',
'##[group] foo': ' foo',
'::group::foo': 'foo',
'##[endgroup]': '',
'::endgroup::': '',
// parser shouldn't do any trim, keep origin output as-is
'##[error] foo': ' foo',
'[command] foo': ' foo',
// hidden is special, it is actually skipped before creating
'##[add-matcher]foo': 'foo',
'::add-matcher::foo': 'foo',
'::remove-matcher foo::': ' foo::', // not correctly parsed, but we don't need it
};
for (const [input, html] of Object.entries(cases)) {
const line = {index: 0, timestamp: 0, message: input};
const cmd = parseLogLineCommand(line);
const el = createLogLineMessage(line, cmd);
expect(el.outerHTML).toBe(html);
}
});