import {createLogLineMessage, parseLogLineCommand} from './ActionRunView.ts';
test('LogLineMessage', () => {
const cases = {
'normal message': 'normal message',
'##[group] foo': ' foo',
'::group::foo': 'foo',
'##[endgroup]': '',
'::endgroup::': '',
'##[error] foo': 'Error: foo',
'##[warning] foo': 'Warning: foo',
'##[notice] foo': 'Notice: foo',
'##[debug] foo': 'Debug: foo',
'::error::foo': 'Error: foo',
'::warning file=test.js,line=1::foo': 'Warning: foo',
'::notice::foo': 'Notice: foo',
'::debug::foo': 'Debug: 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);
}
});