Skip to content

Commit 5d3f1fd

Browse files
fix a little stuff around intro section closing
1 parent c3942bd commit 5d3f1fd

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/steps/writeReadme/findIntroSectionClose.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ describe("findIntroSectionClose", () => {
4040
4141
Next line.
4242
`,
43-
13,
43+
14,
4444
],
4545
])("%s", (contents, expected) => {
4646
expect(findIntroSectionClose(contents)).toEqual(expected);

src/steps/writeReadme/findIntroSectionClose.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@ export function findIntroSectionClose(contents: string) {
1818
}
1919

2020
// Lastly, go for the second line altogether
21-
return contents.indexOf("\n", 2);
21+
return contents.indexOf("\n", 1) + 1;
2222
}

src/steps/writeReadme/index.test.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ describe("writeReadme", () => {
130130
});
131131

132132
it("adds sections when the README.md already exists and is sparse", async () => {
133-
mockReadFileSafe.mockResolvedValueOnce(`# ${options.title}`);
133+
mockReadFileSafe.mockResolvedValueOnce(`# ${options.title}\n`);
134134

135135
await writeReadme(options);
136136

@@ -173,7 +173,7 @@ describe("writeReadme", () => {
173173
\`\`\`
174174
\`\`\`ts
175175
import { greet } from \\"test-repository\\";
176-
\`\`\`e
176+
\`\`\`
177177
178178
## Contributors
179179
<!-- spellchecker: disable -->
@@ -199,7 +199,7 @@ describe("writeReadme", () => {
199199
});
200200

201201
it("adds all-contributors content when directed to and the indicator does not yet exist", async () => {
202-
mockReadFileSafe.mockResolvedValueOnce(`# ${options.title}`);
202+
mockReadFileSafe.mockResolvedValueOnce(`# ${options.title}\n`);
203203

204204
await writeReadme({
205205
...options,
@@ -245,7 +245,7 @@ describe("writeReadme", () => {
245245
\`\`\`
246246
\`\`\`ts
247247
import { greet } from \\"test-repository\\";
248-
\`\`\`e
248+
\`\`\`
249249
250250
## Contributors
251251
<!-- spellchecker: disable -->

0 commit comments

Comments
 (0)