Skip to content

Commit

Permalink
added tests
Browse files Browse the repository at this point in the history
  • Loading branch information
beanumber committed Jul 15, 2019
1 parent e0b70f0 commit 30c896e
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 6 deletions.
7 changes: 4 additions & 3 deletions DESCRIPTION
@@ -1,8 +1,8 @@
Package: teamcolors
Type: Package
Title: Color Palettes for Pro Sports Teams
Date: 2019-07-12
Version: 0.0.1.9008
Date: 2019-07-15
Version: 0.0.2
Authors@R: c(
person("Benjamin S.", "Baumer", email = "ben.baumer@gmail.com", role = c("aut", "cre")),
person("Gregory J.", "Matthews", email = "gjm112@gmail.com", role = c("aut")),
Expand All @@ -17,7 +17,8 @@ Imports:
dplyr,
ggplot2
Suggests:
Lahman
Lahman,
testthat (>= 2.1.0)
License: GPL
Encoding: UTF-8
LazyData: true
Expand Down
1 change: 1 addition & 0 deletions NEWS.md
Expand Up @@ -7,6 +7,7 @@
* Added color palette functionality through named vectors
* Added links to logos
* Added NCAA colors (thanks `lbenz`!) (https://github.com/beanumber/teamcolors/pull/11)
* Added tests

# teamcolors 0.0.1

Expand Down
6 changes: 3 additions & 3 deletions cran-comments.md
@@ -1,7 +1,7 @@
## Test environments
* local OS X install, R 3.4.1
* local OS X install, R 3.6.0
* local Ubuntu install, R 3.6.0
* ubuntu 14.04.5 (on travis-ci), R 3.4.1, oldrel, release, devel
* ubuntu 14.04.5 (on travis-ci), oldrel, release, devel
* win-builder (devel and release)

## R CMD check results
Expand All @@ -10,7 +10,7 @@

## Reverse dependencies

This is a new release, so there are no reverse dependencies.
There are no reverse dependencies.

---

4 changes: 4 additions & 0 deletions tests/testthat.R
@@ -0,0 +1,4 @@
library(testthat)
library(teamcolors)

test_check("teamcolors")
11 changes: 11 additions & 0 deletions tests/testthat/test-colors.R
@@ -0,0 +1,11 @@
test_that("colors work", {
expect_equal(ncol(teamcolors), 8)
expect_is(teamcolors, "tbl_df")

expect_is(team_pal(), "character")
expect_gt(sum(team_pal(2) != team_pal(), na.rm = TRUE) / nrow(teamcolors), 0.95)
expect_error(team_pal(7), "between")

expect_equal(class(scale_color_teams()), class(scale_color_discrete()))
expect_equal(class(scale_fill_teams()), class(scale_fill_discrete()))
})

0 comments on commit 30c896e

Please sign in to comment.