diff --git a/tests/ARCValidationPackages.Tests/TopLevelAPITests.fs b/tests/ARCValidationPackages.Tests/TopLevelAPITests.fs index 7e9f2bf..c319aa6 100644 --- a/tests/ARCValidationPackages.Tests/TopLevelAPITests.fs +++ b/tests/ARCValidationPackages.Tests/TopLevelAPITests.fs @@ -12,54 +12,98 @@ open AVPRIndex.Domain [] let ``Toplevel API tests`` = testSequenced (testList "Toplevel API tests" [ + testSequenced (testList "Toplevel github API tests" [ - test "getSyncedConfigAndCache returns OK" { - resetConfigEnvironment() - let syncResult = API.GetSyncedConfigAndCache(false, ?Token = get_gh_api_token()) - Expect.isOk (syncResult) "updateIndex did not return OK" - } + test "getSyncedConfigAndCache returns OK" { + resetConfigEnvironment() + let syncResult = API.GetSyncedConfigAndCache(false, ?Token = get_gh_api_token()) + Expect.isOk (syncResult) "updateIndex did not return OK" + } - testSequenced (testList "getSyncedConfigAndCache" [ + testSequenced (testList "getSyncedConfigAndCache" [ - yield! testFixture (Fixtures.withFreshConfigAndCachePreview (get_gh_api_token())) [ - "Fresh config filepath", - fun (freshConfig, _) -> - Expect.equal freshConfig.ConfigFilePath expected_config_file_path "config file path is not correct" + yield! testFixture (Fixtures.withFreshConfigAndCachePreview (get_gh_api_token())) [ + "Fresh config filepath", + fun (freshConfig, _) -> + Expect.equal freshConfig.ConfigFilePath expected_config_file_path "config file path is not correct" - "Fresh package cache preview folder", - fun (freshConfig, _) -> - Expect.equal freshConfig.PackageCacheFolderPreview expected_package_cache_folder_path_preview "package cache preview folder path is not correct" + "Fresh package cache preview folder", + fun (freshConfig, _) -> + Expect.equal freshConfig.PackageCacheFolderPreview expected_package_cache_folder_path_preview "package cache preview folder path is not correct" - "Fresh package cache release folder", - fun (freshConfig, _) -> - Expect.equal freshConfig.PackageCacheFolderRelease expected_package_cache_folder_path_release "package cache release folder path is not correct" + "Fresh package cache release folder", + fun (freshConfig, _) -> + Expect.equal freshConfig.PackageCacheFolderRelease expected_package_cache_folder_path_release "package cache release folder path is not correct" - "Fresh config package index contains packages", - fun (freshConfig, _) -> - Expect.isGreaterThan freshConfig.PackageIndex.Length 0 "fresh config package index was empty" + "Fresh config package index contains packages", + fun (freshConfig, _) -> + Expect.isGreaterThan freshConfig.PackageIndex.Length 0 "fresh config package index was empty" - "Fresh config package index contains test package", - fun (freshConfig, _) -> - Expect.isTrue (Array.exists (fun (x:ValidationPackageIndex) -> x.Metadata.Name = "test") freshConfig.PackageIndex) "fresh config package index was empty" - "Fresh package cache is empty", + "Fresh config package index contains test package", + fun (freshConfig, _) -> + Expect.isTrue (Array.exists (fun (x:ValidationPackageIndex) -> x.Metadata.Name = "test") freshConfig.PackageIndex) "fresh config package index was empty" + "Fresh package cache is empty", - fun (_, freshCache) -> - Expect.equal freshCache.Count 0 "fresh cache was not empty" - ] + fun (_, freshCache) -> + Expect.equal freshCache.Count 0 "fresh cache was not empty" + ] - ]) + ]) + + testSequenced (testList "updateIndex" [ + yield! testFixture (Fixtures.withFreshConfigAndCachePreview (get_gh_api_token())) [ + "updateIndex returns OK", + fun (freshConfig, _) -> + Expect.isOk (API.UpdateIndex(freshConfig, ?Token = get_gh_api_token())) "updateIndex did not return OK" + ] + ]) - testSequenced (testList "updateIndex" [ - yield! testFixture (Fixtures.withFreshConfigAndCachePreview (get_gh_api_token())) [ - "updateIndex returns OK", - fun (freshConfig, _) -> - Expect.isOk (API.UpdateIndex(freshConfig, ?Token = get_gh_api_token())) "updateIndex did not return OK" - ] + testSequenced (testList "saveAndCachePackage" [ + + ]) ]) + testSequenced (testList "Toplevel AVPR API tests" [ + + test "getSyncedConfigAndCache returns OK" { + resetConfigEnvironment() + let syncResult = API.GetSyncedConfigAndCache(true) + Expect.isOk (syncResult) "updateIndex did not return OK" + } + + testSequenced (testList "getSyncedConfigAndCache" [ + + yield! testFixture (Fixtures.withFreshConfigAndCachePreview (get_gh_api_token())) [ + "Fresh config filepath", + fun (freshConfig, _) -> + Expect.equal freshConfig.ConfigFilePath expected_config_file_path "config file path is not correct" + + "Fresh package cache preview folder", + fun (freshConfig, _) -> + Expect.equal freshConfig.PackageCacheFolderPreview expected_package_cache_folder_path_preview "package cache preview folder path is not correct" + + "Fresh package cache release folder", + fun (freshConfig, _) -> + Expect.equal freshConfig.PackageCacheFolderRelease expected_package_cache_folder_path_release "package cache release folder path is not correct" + + "Fresh config package index contains packages", + fun (freshConfig, _) -> + Expect.isGreaterThan freshConfig.PackageIndex.Length 0 "fresh config package index was empty" + + "Fresh config package index contains test package", + fun (freshConfig, _) -> + Expect.isTrue (Array.exists (fun (x:ValidationPackageIndex) -> x.Metadata.Name = "test") freshConfig.PackageIndex) "fresh config package index was empty" + "Fresh package cache is empty", + + fun (_, freshCache) -> + Expect.equal freshCache.Count 0 "fresh cache was not empty" + ] + + ]) - testSequenced (testList "saveAndCachePackage" [ + testSequenced (testList "saveAndCachePackage" [ + ]) ]) ]) \ No newline at end of file