Skip to main content
  • Home
  • Development
  • Documentation
  • Donate
  • Operational login
  • Browse the archive

swh logo
SoftwareHeritage
Software
Heritage
Archive
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

  • 27e04eb
  • /
  • testthat
  • /
  • test-build-home-community.R
Raw File Download

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • content
  • directory
content badge Iframe embedding
swh:1:cnt:1309199a51ad0113006e917a350931f2affe6001
directory badge Iframe embedding
swh:1:dir:8202d8d3cabcb54cbec8e0f68269e780d6392dd2

This interface enables to generate software citations, provided that the root directory of browsed objects contains a citation.cff or codemeta.json file.
Select below a type of object currently browsed in order to generate citations for them.

  • content
  • directory
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
test-build-home-community.R
context("test-build-home-community.R")

test_that("has_coc works", {
  # .github in this test is build-ignored to prevent a NOTE about an unexpected
  # hidden directory. Skip on CMD CHECK if the .github directory is not present.s
  skip_if_not(dir_exists(path(test_path("assets/site-dot-github"),
                              ".github"))[[1]])
  expect_true(has_coc(test_path("assets/site-dot-github")))
  expect_false(has_coc(test_path("assets/site-orcid")))
})

test_that("has_contributing works", {
  expect_false(has_contributing(test_path("assets/site-orcid")))
})

test_that("community section is added if COC present", {

  pkg <- test_path("assets/site-dot-github")

  # .github in this test is build-ignored to prevent a NOTE about an unexpected
  # hidden directory. Skip on CMD CHECK if the .github directory is not present.
  skip_if_not(dir_exists(path(pkg, ".github"))[[1]])

  comm <- data_home_sidebar_community(pkg)
  expect_equal(comm,
               "<div class='community'>\n<h2>Community</h2>\n<ul class='list-unstyled'>\n<li><a href=\"CODE_OF_CONDUCT.html\">Code of conduct</a></li>\n</ul>\n</div>\n")
})

test_that("community section is not added if no community files", {
  pkg <- test_path("assets/site-orcid")

  comm <- data_home_sidebar_community(pkg)

  expect_equal(comm, "")
})

back to top

Software Heritage — Copyright (C) 2015–2025, The Software Heritage developers. License: GNU AGPLv3+.
The source code of Software Heritage itself is available on our development forge.
The source code files archived by Software Heritage are available under their own copyright and licenses.
Terms of use: Archive access, API— Content policy— Contact— JavaScript license information— Web API