Skip to content

Commit

Permalink
Merge pull request #56 from katilingban/dev
Browse files Browse the repository at this point in the history
tests for paleta
  • Loading branch information
ernestguevarra authored Mar 12, 2024
2 parents 9f016ee + 102d1bf commit df34f5a
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 4 deletions.
6 changes: 3 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ Imports:
Suggests:
knitr,
rmarkdown,
spelling
spelling,
testthat (>= 3.0.0)
Encoding: UTF-8
Language: en-GB
LazyData: true
Expand All @@ -32,5 +33,4 @@ Roxygen: list(markdown = TRUE)
URL: https://github.com/katilingban/paleta,http://katilingban.io/paleta/
BugReports: https://github.com/katilingban/paleta/issues
VignetteBuilder: knitr


Config/testthat/edition: 3
2 changes: 1 addition & 1 deletion R/theme_paleta.R
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ set_paleta_font <- function() {
#' @param axis Add x or y axes? `TRUE`, `FALSE`, "`xy`". Default is FALSE.
#' @param ticks Logical. Should ticks be added? Default is FALSE.
#'
#' @return A [ggplot2] theme.
#' @returns A [ggplot2] theme.
#'
theme_paleta <- function(base_family = set_paleta_font(),
base_size = 11.5,
Expand Down
12 changes: 12 additions & 0 deletions tests/testthat.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# This file is part of the standard setup for testthat.
# It is recommended that you do not modify it.
#
# Where should you do additional test configuration?
# Learn more about the roles of various files in:
# * https://r-pkgs.org/testing-design.html#sec-tests-files-overview
# * https://testthat.r-lib.org/articles/special-files.html

library(testthat)
library(paleta)

test_check("paleta")
13 changes: 13 additions & 0 deletions tests/testthat/test-theme_paleta.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Test paleta ------------------------------------------------------------------

## Test paleta_fonts class
testthat::expect_type(paleta_fonts, "list")

## Test length of paleta fonts
testthat::expect_equal(length(paleta_fonts), 3)

## Test output of set_paleta_font
testthat::expect_type(set_paleta_font(), "character")
testthat::expect_equal(length(set_paleta_font()), 1)


0 comments on commit df34f5a

Please sign in to comment.