Skip to content

Commit

Permalink
fix(#98): test for formatted-summary.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
h1alexbel committed May 2, 2024
1 parent ec6aeed commit 7f7b67b
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/formatted-summary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ export class FormattedSummary implements Scalar<string> {
/**
* Ctor.
* @param problems Problems
* @param suggestions Suggestions
* @param suggestion Suggestion
*/
constructor(
private readonly problems: any,
private readonly suggestions: any
private readonly suggestion: any
) {
}

Expand All @@ -44,7 +44,7 @@ export class FormattedSummary implements Scalar<string> {
${this.problems}
### Suggestion
${this.suggestions}
${this.suggestion}
`;
}
}
45 changes: 45 additions & 0 deletions tests/formatted-summary.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2023-2024 Tracehub.git
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

import {FormattedSummary} from "../src/formatted-summary";

/**
* Test cases for FormattedSummary.
*/
describe('Test cases for FormattedSummary', () => {
test("returns formatted summary", () => {
const problems = "some problems";
const suggestion = "some suggestion";
const fmt = new FormattedSummary(problems, suggestion).value();
expect(fmt).toBe(
`
### Problems
${problems}
### Suggestion
${suggestion}
`
)
});
});

0 comments on commit 7f7b67b

Please sign in to comment.