"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const migrate_1 = require("../../src/migrate");
const util_1 = require("../../src/util");
const evalFactory_1 = __importDefault(require("../factories/evalFactory"));
describe('listPreviousResults', () => {
    beforeAll(async () => {
        await (0, migrate_1.runDbMigrations)();
    });
    it('returns previous results', async () => {
        const eval1 = await evalFactory_1.default.create();
        const eval2 = await evalFactory_1.default.create();
        const evalOld = await evalFactory_1.default.createOldResult();
        const results = await (0, util_1.listPreviousResults)();
        expect(results).toHaveLength(3);
        expect(results).toContainEqual(expect.objectContaining({
            evalId: eval1.id,
            createdAt: eval1.createdAt,
            numTests: 2,
        }));
        expect(results).toContainEqual(expect.objectContaining({
            evalId: eval2.id,
            createdAt: eval2.createdAt,
            description: eval2.description || null,
            numTests: 2,
        }));
        expect(results).toContainEqual(expect.objectContaining({
            evalId: evalOld.id,
            createdAt: evalOld.createdAt,
            numTests: 1,
        }));
    });
});
//# sourceMappingURL=listPrevious.test.js.map