"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const auto_1 = tslib_1.__importDefault(require("../auto"));
const logger_1 = require("../utils/logger");
const importMock = jest.fn();
jest.mock('import-cwd', () => (path) => importMock(path));
jest.mock('env-ci', () => () => ({ isCi: false, branch: 'master' }));
jest.mock('../utils/exec-promise', () => () => '');
const defaults = {
    owner: 'foo',
    repo: 'bar',
    token: 'XXXX'
};
const search = jest.fn();
jest.mock('cosmiconfig', () => ({
    cosmiconfig: () => ({
        search
    })
}));
jest.mock('@octokit/rest', () => {
    var _a;
    const instance = (_a = class MockOctokit {
            constructor() {
                this.authenticate = () => undefined;
                this.search = {
                    issuesAndPullRequests: () => ({ data: { items: [] } })
                };
                this.hook = {
                    error: () => undefined
                };
            }
        },
        _a.plugin = () => instance,
        _a);
    return instance;
});
// @ts-ignore
jest.mock('gitlog', () => (a, cb) => {
    cb(undefined, [
        {
            rawBody: 'foo'
        },
        {
            rawBody: 'foo'
        }
    ]);
});
describe('Auto', () => {
    test('should add to changelog', async () => {
        const auto = new auto_1.default(Object.assign({ plugins: [] }, defaults));
        auto.logger = logger_1.dummyLog();
        await auto.loadConfig();
        const addToChangelog = jest.fn();
        auto.release.addToChangelog = addToChangelog;
        jest.spyOn(auto.release, 'generateReleaseNotes').mockImplementation();
        jest.spyOn(auto.release, 'getCommitsInRelease').mockImplementation();
        await auto.changelog({ from: 'v1.0.0' });
        expect(addToChangelog).toHaveBeenCalled();
    });
});
//# sourceMappingURL=auto-make-changelog.test.js.map