-
-
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.
test: stub out all the functionality
- Loading branch information
Showing
2 changed files
with
54 additions
and
3 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 |
---|---|---|
@@ -1,11 +1,45 @@ | ||
// eslint-disable-next-line import/no-extraneous-dependencies | ||
import { describe, it, expect } from 'vitest'; | ||
import { describe, it, expect, fail } from 'vitest'; | ||
|
||
import convertCSVToAPKG from './csv-to-apkg'; | ||
import convertCSVToAPKG, { CSVReader } from './csv-to-apkg'; | ||
|
||
const CSV_EXAMPLE = ` | ||
Word,Meaning,Tags | ||
お願いします,Please,one | ||
ありがとう,Thank you (impolite),two | ||
ありがとうございます。,Thank you (polite),three | ||
`; | ||
|
||
describe("Convert CSV to APKG", () => { | ||
it("converts CSV to APKG format", () => { | ||
it.skip("converts CSV to APKG format", () => { | ||
expect(convertCSVToAPKG()).toContain("magic") | ||
}); | ||
|
||
it.skip("reads the CSV content correctly", () => { | ||
const reader = new CSVReader(CSV_EXAMPLE); | ||
expect(reader.getHeaders()).toBe(['Word', 'Meaning', 'Tags']); | ||
expect(reader.getRows()).toBe( | ||
[ | ||
['お願いします', 'Please', 'one'], | ||
['ありがとう', 'Thank you (impolite)', 'two'], | ||
['ありがとうございます。', 'Thank you (polite)', 'three'] | ||
] | ||
) | ||
}); | ||
|
||
it.skip("Transform to decks / notes", () => { | ||
const reader = new CSVReader(CSV_EXAMPLE); | ||
const mapper = new DataMapper(reader.parseSync()) | ||
expect(mapper.getDecks()).toBe(['Default']) | ||
}); | ||
|
||
it.skip("uses filename as deck name", () => { | ||
console.info("to be implemented"); | ||
}) | ||
|
||
it.skip("uses custom filename as deck name", () => { | ||
console.info("to be implemented"); | ||
}) | ||
|
||
}) | ||
|
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 |
---|---|---|
@@ -1,3 +1,20 @@ | ||
export default function convertCSVToAPKG(): string | null { | ||
throw new Error("To be implemented") | ||
} | ||
|
||
|
||
export type CSVColumnHeader = string | ||
export type CSVRow = string | ||
|
||
export class CSVReader { | ||
|
||
constructor(readonly content: string) {} | ||
|
||
getHeaders(): CSVColumnHeader { | ||
throw new Error("not implemented") | ||
} | ||
|
||
getRows(): CSVRow { | ||
throw new Error("not implemented") | ||
} | ||
} |