Fix tests to match code changes

This commit is contained in:
Dave Bartolomeo 2022-08-10 13:11:34 -04:00
Родитель 838a2b71ac
Коммит 51fb03b4b1
1 изменённых файлов: 6 добавлений и 6 удалений

Просмотреть файл

@ -8,8 +8,8 @@ import { parseViewerData } from '../../src/pure/log-summary-parser';
describe('Evaluator log summary tests', async function() {
describe('for a valid summary text', async function() {
it('should return only valid EvalLogData objects', async function() {
const validSummaryText = await fs.readFile(path.join(__dirname, 'evaluator-log-summaries/valid-summary.jsonl'), 'utf8');
const logDataItems = parseViewerData(validSummaryText.toString());
const validSummaryPath = path.join(__dirname, 'evaluator-log-summaries/valid-summary.jsonl');
const logDataItems = await parseViewerData(validSummaryPath);
expect(logDataItems).to.not.be.undefined;
expect(logDataItems.length).to.eq(3);
for (const item of logDataItems) {
@ -27,14 +27,14 @@ describe('Evaluator log summary tests', async function() {
});
it('should not parse a summary header object', async function() {
const invalidHeaderText = await fs.readFile(path.join(__dirname, 'evaluator-log-summaries/invalid-header.jsonl'), 'utf8');
const logDataItems = parseViewerData(invalidHeaderText);
const invalidHeaderPath = path.join(__dirname, 'evaluator-log-summaries/invalid-header.jsonl');
const logDataItems = await parseViewerData(invalidHeaderPath);
expect(logDataItems.length).to.eq(0);
});
it('should not parse a log event missing RA or millis fields', async function() {
const invalidSummaryText = await fs.readFile(path.join(__dirname, 'evaluator-log-summaries/invalid-summary.jsonl'), 'utf8');
const logDataItems = parseViewerData(invalidSummaryText);
const invalidSummaryPath = path.join(__dirname, 'evaluator-log-summaries/invalid-summary.jsonl');
const logDataItems = await parseViewerData(invalidSummaryPath);
expect(logDataItems.length).to.eq(0);
});
});