Skip to content

Commit

Permalink
Add tests for edgecase ✅
Browse files Browse the repository at this point in the history
  • Loading branch information
Freymaurer committed Jan 12, 2024
1 parent d42faaf commit 533dab0
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 20 deletions.
2 changes: 1 addition & 1 deletion tests/ARCtrl/Template.Tests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ let private tests_equality = testList "equality" [
]

let private tests_Web = testList "Web" [
ptestCaseAsync "getTemplates" <| async {
testCaseAsync "getTemplates" <| async {
let! templatesMap = ARCtrl.Template.Web.getTemplates(None)
Expect.isTrue (templatesMap.Length > 0) "Count > 0"
}
Expand Down
60 changes: 41 additions & 19 deletions tests/ISA/ISA.Json.Tests/Json.Tests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -135,33 +135,55 @@ let testDecode =

let testOntoloyAnnotation =
testList "OntologyAnnotation" [
testCase "ReaderSuccess" (fun () ->

testCase "ReaderSuccess" (fun () ->

let result = OntologyAnnotation.fromJsonString OntologyAnnotation.peptidase
let result = OntologyAnnotation.fromJsonString OntologyAnnotation.peptidase


let comment = Comment.create(Name = "comment",Value = "This is a comment")
let expected =
OntologyAnnotation.create("protease","Peptidase", "MS", "http://purl.obolibrary.org/obo/NCIT_C16965",Comments = [|comment|])
let comment = Comment.create(Name = "comment",Value = "This is a comment")
let expected =
OntologyAnnotation.create("protease","Peptidase", "MS", "http://purl.obolibrary.org/obo/NCIT_C16965",Comments = [|comment|])

Expect.equal result expected "Source did not match"
)
testCase "WriterOutputMatchesInput" (fun () ->
Expect.equal result expected "Source did not match"
)
testCase "WriterOutputMatchesInput" (fun () ->

let o_read_in = OntologyAnnotation.fromJsonString OntologyAnnotation.peptidase
let o_out = OntologyAnnotation.toJsonString o_read_in
let o_read_in = OntologyAnnotation.fromJsonString OntologyAnnotation.peptidase
let o_out = OntologyAnnotation.toJsonString o_read_in

let expected =
OntologyAnnotation.peptidase
|> Utils.wordFrequency
let expected =
OntologyAnnotation.peptidase
|> Utils.wordFrequency

let actual =
o_out
|> Utils.wordFrequency
let actual =
o_out
|> Utils.wordFrequency

Expect.sequenceEqual actual expected "Written processInput does not match read process input"
)
Expect.sequenceEqual actual expected "Written processInput does not match read process input"
)

testCase "Read AnnotationValue - integer" <| fun _ ->
let json = """{
"annotationValue": 4242424
}"""
let oa = OntologyAnnotation.fromJsonString json
let name = Expect.wantSome oa.Name ""
Expect.equal name "4242424" ""
testCase "Read AnnotationValue - float" <| fun _ ->
let json = """{
"annotationValue": 42.42
}"""
let oa = OntologyAnnotation.fromJsonString json
let name = Expect.wantSome oa.Name ""
Expect.equal name "42.42" ""
testCase "Read AnnotationValue - string" <| fun _ ->
let json = """{
"annotationValue": "Example"
}"""
let oa = OntologyAnnotation.fromJsonString json
let name = Expect.wantSome oa.Name ""
Expect.equal name "Example" ""
]

let testOntoloyAnnotationLD =
Expand Down

0 comments on commit 533dab0

Please sign in to comment.