Files
anki-static/AnkiStatic.Test/TestEndToEnd.fs
patrick 73a0342291
All checks were successful
ci/woodpecker/push/build Pipeline was successful
ci/woodpecker/push/all-checks-complete Pipeline was successful
Simplify flake (#9)
Co-authored-by: Smaug123 <3138005+Smaug123@users.noreply.github.com>
Reviewed-on: #9
2024-05-31 23:33:46 +00:00

31 lines
887 B
Forth

namespace AnkiStatic.Test
open AnkiStatic
open NUnit.Framework
open System
open System.IO
[<TestFixture>]
module TestEndToEnd =
type private Dummy = class end
[<TestCase "example1.json">]
[<TestCase "CapitalsOfTheWorld.json">]
let ``End-to-end test of example1.json`` (fileName : string) =
let assembly = typeof<Dummy>.Assembly
let json = Utils.readResource assembly fileName
let collection, notes =
JsonCollection.deserialiseString json |> JsonCollection.toInternal
let outputFile =
Path.GetTempFileName ()
|> fun f -> Path.ChangeExtension (f, ".apkg")
|> FileInfo
let collection = SerialisedCollection.toSqlite collection
Sqlite.writeAll (Random 1) collection notes outputFile |> fun t -> t.Result
Console.WriteLine $"Written file: %s{outputFile.FullName}"