# Generated by roxytest: Do not edit by hand!
# File R/subrecords.R: @tests
test_that("Function LINEAGE_LINKED_HEADER_EXTENSION() @ L37", {
expect_equal(LINEAGE_LINKED_HEADER_EXTENSION("tidyged"),
tibble::tibble(level = 0, tag = "SOUR", value = "tidyged"))
expect_snapshot_value(LINEAGE_LINKED_HEADER_EXTENSION("tidyged",
business_address = ADDRESS_STRUCTURE("Road name",
"City",
"State",
"ABC",
"UK",
123445567,
"email@domain.com",
4587375238427,
"www.url.com"),
name_of_source_data = "source data name",
publication_date = date_exact(2009,5,25),
copyright_source_data = "source copyright",
receiving_system_name = "destination system",
file_creation_date = date_exact(2008,4,3),
file_creation_time = "10:56:05",
language_of_text = "English",
xref_subm = "@U1@",
gedcom_file_name = "file.ged",
copyright_gedcom_file = "gedcom copyright",
gedcom_content_description = "gedcom_description"), "json2")
})
test_that("Function ADDRESS_STRUCTURE() @ L135", {
expect_error(ADDRESS_STRUCTURE(letters[1:4]))
expect_error(ADDRESS_STRUCTURE("address", address_city = 1:2))
expect_error(ADDRESS_STRUCTURE("address", address_state = 1:2))
expect_error(ADDRESS_STRUCTURE("address", address_postal_code = 1:2))
expect_error(ADDRESS_STRUCTURE("address", phone_number = 1:4))
expect_error(ADDRESS_STRUCTURE("address", address_email = 1:4))
expect_error(ADDRESS_STRUCTURE("address", address_fax = 1:4))
expect_error(ADDRESS_STRUCTURE("address", address_web_page = 1:4))
expect_error(ADDRESS_STRUCTURE(paste0(rep("a", 61), collapse = "")))
expect_error(ADDRESS_STRUCTURE("address", address_city = paste0(rep("a", 61), collapse = "")))
expect_error(ADDRESS_STRUCTURE("address", address_state = paste0(rep("a", 61), collapse = "")))
expect_error(ADDRESS_STRUCTURE("address", address_postal_code = paste0(rep("a", 11), collapse = "")))
expect_error(ADDRESS_STRUCTURE("address", address_country = paste0(rep("a", 61), collapse = "")))
expect_error(ADDRESS_STRUCTURE("address", address_web_page = paste0(rep("a", 2048), collapse = "")))
expect_equal(ADDRESS_STRUCTURE(), tibble::tibble())
expect_snapshot_value(ADDRESS_STRUCTURE("Road name"), "json2")
expect_snapshot_value(ADDRESS_STRUCTURE(letters[1:3]), "json2")
expect_snapshot_value(ADDRESS_STRUCTURE(letters[1:2], address_country = "UK"), "json2")
expect_snapshot_value(ADDRESS_STRUCTURE(
local_address_lines = c("road1", "road2", "road3"),
address_city = "city",
address_state = "state",
address_postal_code = "XYZ123",
address_country = "country",
phone_number = 1:3 * 6345645,
address_email = c("email1@domain.co.uk","email2@domain.co.uk","email3@domain.co.uk"),
address_fax = 4:6 * 937463,
address_web_page = c("http://www.domain1.com","http://www.domain2.com","http://www.domain3.com")), "json2")
})
test_that("Function ASSOCIATION_STRUCTURE() @ L209", {
expect_error(ASSOCIATION_STRUCTURE())
expect_error(ASSOCIATION_STRUCTURE("@1@"))
expect_error(ASSOCIATION_STRUCTURE(c("@1@", "@2@"), "Godfather"))
expect_equal(ASSOCIATION_STRUCTURE(character()), tibble::tibble())
expect_equal(ASSOCIATION_STRUCTURE("", character()), tibble::tibble())
expect_snapshot_value(ASSOCIATION_STRUCTURE("@I1@", "Godfather"), "json2")
expect_snapshot_value(ASSOCIATION_STRUCTURE("@I1@", "Father",
notes = list(NOTE_STRUCTURE("This is a note")),
source_citations = list(SOURCE_CITATION("@S1@"))), "json2")
})
test_that("Function CHANGE_DATE() @ L245", {
expect_snapshot_value(CHANGE_DATE(date_exact(1990, 10, 5)), "json2")
expect_snapshot_value(CHANGE_DATE(date_exact(2008, 12, 18), time_value = "11:00:08.56"), "json2")
expect_snapshot_value(CHANGE_DATE(date_exact(1990, 10, 5), "10:34:56",
notes = list(NOTE_STRUCTURE("Note 1"),
NOTE_STRUCTURE("Note 2"))), "json2")
})
test_that("Function CHILD_TO_FAMILY_LINK() @ L280", {
expect_error(CHILD_TO_FAMILY_LINK())
expect_error(CHILD_TO_FAMILY_LINK("@1@", pedigree_linkage_type = "foste"))
expect_equal(CHILD_TO_FAMILY_LINK(character()), tibble::tibble())
expect_snapshot_value(CHILD_TO_FAMILY_LINK("@F1@"), "json2")
expect_snapshot_value(CHILD_TO_FAMILY_LINK("@F1@", "birth"), "json2")
})
test_that("Function EVENT_DETAIL() @ L316", {
expect_equal(dim(EVENT_DETAIL()), c(0, 3))
expect_snapshot_value(EVENT_DETAIL(event_or_fact_classification = "Woodworking"), "json2")
expect_snapshot_value(EVENT_DETAIL(place = PLACE_STRUCTURE("Somewhere")), "json2")
expect_snapshot_value(EVENT_DETAIL(address = ADDRESS_STRUCTURE(c("House name", "Road"))), "json2")
})
test_that("Function FAMILY_EVENT_DETAIL() @ L370", {
expect_equal(dim(FAMILY_EVENT_DETAIL()), c(0, 3))
expect_snapshot_value(FAMILY_EVENT_DETAIL(husband_age_at_event = "42y"), "json2")
expect_snapshot_value(FAMILY_EVENT_DETAIL(wife_age_at_event = "40y"), "json2")
expect_snapshot_value(FAMILY_EVENT_DETAIL(husband_age_at_event = "42y", wife_age_at_event = "40y"), "json2")
})
test_that("Function FAMILY_EVENT_STRUCTURE() @ L407", {
expect_error(FAMILY_EVENT_STRUCTURE())
expect_error(FAMILY_EVENT_STRUCTURE("TEST"))
expect_equal(FAMILY_EVENT_STRUCTURE(character()), tibble::tibble())
expect_snapshot_value(FAMILY_EVENT_STRUCTURE("CENS"), "json2")
expect_snapshot_value(FAMILY_EVENT_STRUCTURE("EVEN"), "json2")
expect_snapshot_value(FAMILY_EVENT_STRUCTURE("EVEN", "Random event"), "json2")
expect_snapshot_value(FAMILY_EVENT_STRUCTURE("MARR",
family_event_details = FAMILY_EVENT_DETAIL(wife_age_at_event = "20y")), "json2")
})
test_that("Function INDIVIDUAL_ATTRIBUTE_STRUCTURE() @ L459", {
expect_error(INDIVIDUAL_ATTRIBUTE_STRUCTURE())
expect_error(INDIVIDUAL_ATTRIBUTE_STRUCTURE("TEST"))
expect_error(INDIVIDUAL_ATTRIBUTE_STRUCTURE("FACT"))
expect_error(INDIVIDUAL_ATTRIBUTE_STRUCTURE(c("FACT", "EDUC"), "This is a fact"))
expect_error(INDIVIDUAL_ATTRIBUTE_STRUCTURE("FACT", "This is a fact"))
expect_error(INDIVIDUAL_ATTRIBUTE_STRUCTURE("IDNO", 123456))
expect_equal(INDIVIDUAL_ATTRIBUTE_STRUCTURE(character()), tibble::tibble())
expect_equal(INDIVIDUAL_ATTRIBUTE_STRUCTURE("", character()), tibble::tibble())
expect_snapshot_value(INDIVIDUAL_ATTRIBUTE_STRUCTURE("NATI", "British"), "json2")
expect_snapshot_value(INDIVIDUAL_ATTRIBUTE_STRUCTURE("CAST", "White"), "json2")
expect_snapshot_value(INDIVIDUAL_ATTRIBUTE_STRUCTURE("DSCR", "Tall"), "json2")
expect_snapshot_value(INDIVIDUAL_ATTRIBUTE_STRUCTURE("EDUC", "PhD"), "json2")
expect_snapshot_value(INDIVIDUAL_ATTRIBUTE_STRUCTURE("NCHI", 3), "json2")
expect_snapshot_value(INDIVIDUAL_ATTRIBUTE_STRUCTURE("NMR", 2), "json2")
expect_snapshot_value(INDIVIDUAL_ATTRIBUTE_STRUCTURE("OCCU", "Baker"), "json2")
expect_snapshot_value(INDIVIDUAL_ATTRIBUTE_STRUCTURE("PROP", "House"), "json2")
expect_snapshot_value(INDIVIDUAL_ATTRIBUTE_STRUCTURE("RELI", "Jedi"), "json2")
expect_snapshot_value(INDIVIDUAL_ATTRIBUTE_STRUCTURE("RESI", "Something"), "json2")
expect_snapshot_value(INDIVIDUAL_ATTRIBUTE_STRUCTURE("TITL", "Earl"), "json2")
expect_snapshot_value(INDIVIDUAL_ATTRIBUTE_STRUCTURE("NATI", "British",
individual_event_details = INDIVIDUAL_EVENT_DETAIL(age_at_event = "0y")), "json2")
})
test_that("Function INDIVIDUAL_EVENT_DETAIL() @ L515", {
expect_equal(dim(INDIVIDUAL_EVENT_DETAIL()), c(0, 3))
expect_snapshot_value(INDIVIDUAL_EVENT_DETAIL(age_at_event = "5y"), "json2")
})
test_that("Function INDIVIDUAL_EVENT_STRUCTURE() @ L551", {
expect_error(INDIVIDUAL_EVENT_STRUCTURE())
expect_error(INDIVIDUAL_EVENT_STRUCTURE("BLAH"))
expect_error(INDIVIDUAL_EVENT_STRUCTURE("ADOP", adopted_by_which_parent = "WHO"))
expect_equal(INDIVIDUAL_EVENT_STRUCTURE(character()), tibble::tibble())
expect_snapshot_value(INDIVIDUAL_EVENT_STRUCTURE("BIRT"), "json2")
expect_snapshot_value(INDIVIDUAL_EVENT_STRUCTURE("CHRA"), "json2")
expect_snapshot_value(INDIVIDUAL_EVENT_STRUCTURE("EVEN", "A random event"), "json2")
expect_snapshot_value(INDIVIDUAL_EVENT_STRUCTURE("BIRT", xref_fam = "@F4@"), "json2")
expect_snapshot_value(INDIVIDUAL_EVENT_STRUCTURE("ADOP", xref_fam = "@F4@",
adopted_by_which_parent = "BOTH"), "json2")
})
test_that("Function MULTIMEDIA_LINK() @ L603", {
expect_error(MULTIMEDIA_LINK("ref"))
expect_equal(MULTIMEDIA_LINK(character()), tibble::tibble())
expect_equal(MULTIMEDIA_LINK("@M1@"),
tibble::tibble(level = 0, tag = "OBJE", value = "@M1@"))
})
test_that("Function NOTE_STRUCTURE() @ L627", {
expect_error(NOTE_STRUCTURE(c("test1", "test2")))
expect_equal(NOTE_STRUCTURE(), tibble::tibble())
expect_snapshot_value(NOTE_STRUCTURE("@T1@"), "json2")
expect_snapshot_value(NOTE_STRUCTURE("test text"), "json2")
})
test_that("Function PERSONAL_NAME_PIECES() @ L662", {
expect_equal(dim(PERSONAL_NAME_PIECES()), c(0, 3))
expect_snapshot_value(PERSONAL_NAME_PIECES(name_piece_prefix = "Mr",
name_piece_nickname = "J"), "json2")
expect_snapshot_value(PERSONAL_NAME_PIECES(name_piece_prefix = "Mr",
name_piece_nickname = "J",
notes = list(NOTE_STRUCTURE("Note1"),
NOTE_STRUCTURE("Note2"))), "json2")
})
test_that("Function PERSONAL_NAME_STRUCTURE() @ L754", {
expect_error(PERSONAL_NAME_STRUCTURE())
expect_error(PERSONAL_NAME_STRUCTURE("Joe Bloggs"))
expect_error(PERSONAL_NAME_STRUCTURE("Joe /Bloggs/",
name_pieces = PERSONAL_NAME_PIECES(name_piece_given = "Joe"),
name_phonetic = "Jo Bloggs"))
expect_error(PERSONAL_NAME_STRUCTURE("Joe /Bloggs/",
name_pieces = PERSONAL_NAME_PIECES(name_piece_given = "Joe"),
name_romanised = "Jo Bloggs"))
expect_error(PERSONAL_NAME_STRUCTURE("Joe Bloggs",
name_phonetic = c("Joe Blogs", "Jo Bloggs")))
expect_error(PERSONAL_NAME_STRUCTURE("Joe /Bloggs/",
name_phonetic = c("Joe Blogs", "Jo Bloggs"),
phonetisation_method = "Can't spell"))
expect_error(PERSONAL_NAME_STRUCTURE("Joe /Bloggs/",
name_phonetic = c("Joe Blogs", "Jo Bloggs"),
phonetisation_method = c("Can't spell", "Can't spell"),
phonetic_name_pieces = list(PERSONAL_NAME_PIECES(name_piece_given = "Joe",
name_piece_surname = "Blogs"))))
expect_error(PERSONAL_NAME_STRUCTURE("Joe Bloggs",
name_romanised = c("Joe Blogs", "Jo Bloggs")))
expect_error(PERSONAL_NAME_STRUCTURE("Joe Bloggs",
name_romanised = c("Joe Blogs", "Jo Bloggs"),
romanisation_method = "Can't spell"))
expect_error(PERSONAL_NAME_STRUCTURE("Joe Bloggs",
name_romanised = c("Joe Blogs", "Jo Bloggs"),
romanisation_method = c("Can't spell", "Can't spell"),
romanised_name_pieces = list(PERSONAL_NAME_PIECES(name_piece_given = "Joe",
name_piece_surname = "Blogs"))))
expect_equal(PERSONAL_NAME_STRUCTURE(character()), tibble::tibble())
expect_snapshot_value(PERSONAL_NAME_STRUCTURE("Joe /Bloggs/",
name_pieces = PERSONAL_NAME_PIECES(name_piece_prefix = "Mr",
name_piece_surname = "Bloggs")), "json2")
expect_snapshot_value(PERSONAL_NAME_STRUCTURE("Joe /Bloggs/",
name_pieces = PERSONAL_NAME_PIECES(name_piece_surname = "Bloggs"),
name_phonetic = c("Joe /Blogs/", "Jo /Bloggs/"),
phonetic_name_pieces = list(PERSONAL_NAME_PIECES(name_piece_surname = "Blogs"),
PERSONAL_NAME_PIECES(name_piece_surname = "Bloggs")),
phonetisation_method = c("Can't spell", "Can't spell")), "json2")
expect_snapshot_value(PERSONAL_NAME_STRUCTURE("Joe /Bloggs/",
name_pieces = PERSONAL_NAME_PIECES(name_piece_surname = "Bloggs"),
name_phonetic = c("Joe Blogs", "Jo Bloggs"),
phonetisation_method = c("Can't spell", "Can't spell"),
phonetic_name_pieces =
list(PERSONAL_NAME_PIECES(name_piece_given = "Joe",
name_piece_surname = "Blogs"),
PERSONAL_NAME_PIECES(name_piece_given = "Jo",
name_piece_surname = "Bloggs"))), "json2")
})
test_that("Function PLACE_STRUCTURE() @ L866", {
expect_error(PLACE_STRUCTURE())
expect_error(PLACE_STRUCTURE("Here", place_latitude = "N51.5", place_longitude = "E0.0"))
expect_error(PLACE_STRUCTURE("London",
place_phonetic = c("Lundon", "Lundun")))
expect_error(PLACE_STRUCTURE("London",
place_phonetic = c("Lundon", "Lundun"),
phonetisation_method = "English accent"))
expect_error(PLACE_STRUCTURE("London",
place_romanised = c("Lundon", "Lundun"),
romanisation_method = "English accent"))
expect_snapshot_value(PLACE_STRUCTURE("Greenwich",
place_phonetic = c("Grenidge", "Grenich"),
phonetisation_method = c("English accent", "English accent"),
place_latitude = "N51.5",
place_longitude = "E0.00"), "json2")
expect_snapshot_value(PLACE_STRUCTURE("Greenwich",
place_romanised = c("Grenidge", "Grenich"),
romanisation_method = c("English accent", "English accent"),
place_latitude = "N51.5",
place_longitude = "E0.00"), "json2")
})
test_that("Function SOURCE_CITATION() @ L944", {
expect_equal(SOURCE_CITATION(character()), tibble::tibble())
expect_snapshot_value(SOURCE_CITATION("@S1@"), "json2")
expect_snapshot_value(SOURCE_CITATION("@S1@",
where_within_source = 3, event_type_cited_from = "MARR"), "json2")
expect_snapshot_value(SOURCE_CITATION("@S1@",
where_within_source = 3, role_in_event = "HUSB",
certainty_assessment = 2), "json2")
expect_snapshot_value(SOURCE_CITATION("@S1@", where_within_source = 3,
event_type_cited_from = "CENS",
role_in_event = "WIFE",
entry_recording_date = "28 JUN 1996",
text_from_source = c("text1","text2"),
certainty_assessment = 2), "json2")
})
test_that("Function SOURCE_REPOSITORY_CITATION() @ L1002", {
expect_error(SOURCE_REPOSITORY_CITATION())
expect_error(SOURCE_REPOSITORY_CITATION("@R1@", source_call_number = c("123", "456")))
expect_equal(SOURCE_REPOSITORY_CITATION(character()), tibble::tibble())
expect_snapshot_value(SOURCE_REPOSITORY_CITATION("@R1@", source_call_number = 123), "json2")
})
test_that("Function SPOUSE_TO_FAMILY_LINK() @ L1033", {
expect_error(SPOUSE_TO_FAMILY_LINK())
expect_equal(SPOUSE_TO_FAMILY_LINK(character()), tibble::tibble())
expect_snapshot_value(SPOUSE_TO_FAMILY_LINK("@F2@",
list(NOTE_STRUCTURE("test"))), "json2")
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.