Skip to content

Commit

Permalink
Fix amazon return type
Browse files Browse the repository at this point in the history
  • Loading branch information
RMEngels committed Dec 14, 2022
1 parent 855caec commit 60882b3
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 7 deletions.
12 changes: 10 additions & 2 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,7 @@ var DynamoDBAdapter = /** @class */ (function () {
DynamoDBAdapter.prototype.pullCoverage = function () {
var _a;
return __awaiter(this, void 0, void 0, function () {
var data, error;
var data, error, coverage;
return __generator(this, function (_b) {
switch (_b.label) {
case 0: return [4 /*yield*/, this.getDynamoDbDocumentClient()
Expand All @@ -594,7 +594,15 @@ var DynamoDBAdapter = /** @class */ (function () {
(0, core_1.setFailed)(error);
throw error;
}
return [2 /*return*/, data.Item.coverage];
coverage = {
// @ts-ignore
linesCoverage: parseFloat(data.Item.coverage.linesCoverage),
// @ts-ignore
classCoverage: parseFloat(data.Item.coverage.classCoverage),
// @ts-ignore
methodCoverage: parseFloat(data.Item.coverage.methodCoverage)
};
return [2 /*return*/, coverage];
}
});
});
Expand Down
8 changes: 4 additions & 4 deletions src/Actions/CommentFormatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export class CommentFormatter {
comment += this.classCoverage();

comment += '</details>';

return comment;
}

Expand All @@ -41,7 +41,7 @@ export class CommentFormatter {

return heading;
}

private linesCoverage(): string {
let linesCoverage = 'Lines coverage:\n```diff\n';
if (this.coverageDiff.linesDiff > 0) {
Expand All @@ -58,7 +58,7 @@ export class CommentFormatter {

return linesCoverage;
}

private methodCoverage(): string {
let methodCoverage = 'Method coverage:\n```diff\n';

Expand All @@ -77,7 +77,7 @@ export class CommentFormatter {

return methodCoverage;
}

private classCoverage(): string {
let classCoverage = 'Class coverage:\n```diff\n';

Expand Down
11 changes: 10 additions & 1 deletion src/StorageAdapters/DynamoDBAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,16 @@ export class DynamoDBAdapter implements Adapter {
throw error;
}

return data.Item.coverage;
const coverage: Coverage = {
// @ts-ignore
linesCoverage: parseFloat(data.Item.coverage.linesCoverage),
// @ts-ignore
classCoverage: parseFloat(data.Item.coverage.classCoverage),
// @ts-ignore
methodCoverage: parseFloat(data.Item.coverage.methodCoverage),
}

return coverage;
}

private readonly isCoverageType = (commandOutput: object): commandOutput is Coverage => {
Expand Down

0 comments on commit 60882b3

Please sign in to comment.