-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
05264db
commit 1599620
Showing
3 changed files
with
28 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,21 @@ | ||
test_that("og_create works", { | ||
expect_equal(2 * 2, 4) | ||
expect_equal( | ||
og_create( | ||
title = 'Process the Open Graph Protocol', | ||
type = 'website', | ||
image = 'http://christophertkenny.com/opengraph/logo.png', | ||
url = 'https://christophertkenny.com/opengraph/', | ||
description = 'Parse metadata on websites which use the Open Graph Protocol.' | ||
), | ||
c("<meta property=\"og:title\" content=\"Process the Open Graph Protocol\">", | ||
"<meta property=\"og:type\" content=\"website\">", "<meta property=\"og:image\" content=\"http://christophertkenny.com/opengraph/logo.png\">", | ||
"<meta property=\"og:url\" content=\"https://christophertkenny.com/opengraph/\">", | ||
"<meta property=\"og:description\" content=\"Parse metadata on websites which use the Open Graph Protocol.\">" | ||
) | ||
) | ||
|
||
expect_error(og_create(), '`title` is required.') | ||
expect_error(og_create(title = 'foo'), '`type` is required.') | ||
expect_error(og_create(title = 'foo', type = 'bar'), '`image` is required.') | ||
expect_error(og_create(title = 'foo', type = 'bar', image = 'img'), '`url` is required.') | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
test_that('og_parse works', { | ||
expect_true(is.vector(og_parse('https://www.rstudio.com'))) | ||
expect_true(length(og_parse('https://www.christophertkenny.com/testtesttest')) == 0) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
test_that("og_validate() works", { | ||
|
||
web <- og_parse('https://www.rstudio.com') | ||
|
||
skip_if(length(web) == 0) | ||
|
||
expect_equal(og_validate(web), TRUE) | ||
}) |