-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #22 from lumastic/drew-paste-lyrics
Pasting lyrics from outside sources
- Loading branch information
Showing
10 changed files
with
166 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,8 @@ node_modules | |
/prisma/data.db-journal | ||
/postgres-data | ||
|
||
tailwind.css | ||
|
||
.DS_Store | ||
coverage | ||
build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import type { ILine } from "@/types/song"; | ||
import { convertPlainTextToLines } from "./convertPlainTextToLines"; | ||
|
||
const samplePastedText = | ||
"This is a song\nWith an single stanza\nThis is a song"; | ||
|
||
const singleStanzaConverted: ILine[] = [ | ||
{ | ||
id: expect.any(String), | ||
lyrics: "This is a song", | ||
markings: [], | ||
notes: "", | ||
}, | ||
{ | ||
id: expect.any(String), | ||
lyrics: "With an single stanza", | ||
markings: [], | ||
notes: "", | ||
}, | ||
{ | ||
id: expect.any(String), | ||
lyrics: "This is a song", | ||
markings: [], | ||
notes: "", | ||
}, | ||
]; | ||
|
||
test("Should convert to list with single stanza", () => { | ||
expect(convertPlainTextToLines(samplePastedText)).toMatchObject( | ||
singleStanzaConverted | ||
); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { createMockLine } from "@/test/factories/song.factory"; | ||
import type { ILine } from "@/types/song"; | ||
|
||
export function convertPlainTextToLines(text: string) { | ||
// Split text into Lines | ||
|
||
const textSplitIntoLyrics = text.split("\n"); | ||
const lines = [] as ILine[]; | ||
textSplitIntoLyrics.forEach((lyrics) => { | ||
lines.push(createMockLine({ lyrics })); | ||
}); | ||
|
||
return lines; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters