morning-builds-core
Version:
Core functionality for Morning Builds
73 lines • 3.19 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var BambooClient = /** @class */ (function () {
function BambooClient() {
this.fetchFailingBuilds = jest.fn().mockImplementation(function () {
return Promise
.resolve([
{
link: 'http://company.com/bamboo/rest/api/latest/result/PLAN-01-12',
planName: 'Plan #01',
planKey: 'PLAN01',
resultNumber: 12,
buildState: 'Failed',
failedTestCount: 1,
jobs: [{
jobKey: 'PLAN01-JOB01',
jobName: 'Job #01 from Plan #01',
}]
},
{
link: 'http://company.com/bamboo/rest/api/latest/result/PLAN-02-88',
planName: 'Plan #02',
planKey: 'PLAN02',
resultNumber: 88,
buildState: 'Failed',
failedTestCount: 5,
jobs: [
{
jobKey: 'PLAN02-JOB01',
jobName: 'Job #01 from Plan #02',
},
{
jobKey: 'PLAN02-JOB02',
jobName: 'Job #02 from Plan #02',
}
]
}
]);
});
this.fetchFailingTests = jest.fn().mockImplementation(function (_a) {
var jobKey = _a.jobKey, resultNumber = _a.resultNumber;
var FAILING_TEST_MAP = {
'PLAN01-JOB01': [{ className: 'com.company.data', methodName: 'dataTest01' }],
'PLAN02-JOB01': [{ className: 'com.company.components', methodName: 'componentTest01' }],
'PLAN02-JOB02': [
{ className: 'com.company.components', methodName: 'componentTest02' },
{ className: 'com.company.components', methodName: 'componentTest03' }
]
};
return Promise.resolve(FAILING_TEST_MAP[jobKey]);
});
this.fetchLabels = jest.fn().mockImplementation(function (_a) {
var planKey = _a.planKey;
var LABELS_MAP = {
'PLAN01': ['build-doctor', 'vm-crash'],
'PLAN02': ['some-useless-label'],
};
return Promise.resolve(LABELS_MAP[planKey] || []);
});
this.fetchComments = jest.fn().mockImplementation(function (_a) {
var planKey = _a.planKey, resultNumber = _a.resultNumber;
var COMMENTS_MAP = {
'PLAN01': ['Detected hung build state. Attempting to generate stack trace and terminate spawned sub-processes... - HungBuildKiller Plugin'],
'PLAN02': ['This comment doesn\'t mean a thing to anyone'],
};
return Promise.resolve(COMMENTS_MAP[planKey] || []);
});
}
return BambooClient;
}());
exports.BambooClient = BambooClient;
;
//# sourceMappingURL=bamboo-promises.js.map