Skip to content
This repository has been archived by the owner on Dec 8, 2017. It is now read-only.

Commit

Permalink
Slight improvement to Canonicalizer test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
catherinedevlin committed Feb 3, 2016
1 parent a569cf8 commit 4dfd68d
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 0 deletions.
39 changes: 39 additions & 0 deletions _test/canonicalizer_canonicalize_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# 18F Hub - Docs & connections between team members, projects, and skill sets
#
# Written in 2015 by Mike Bland (michael.bland@gsa.gov)
# on behalf of the 18F team, part of the US General Services Administration:
# https://18f.gsa.gov/
#
# To the extent possible under law, the author(s) have dedicated all copyright
# and related and neighboring rights to this software to the public domain
# worldwide. This software is distributed without any warranty.
#
# You should have received a copy of the CC0 Public Domain Dedication along
# with this software. If not, see
# <https://creativecommons.org/publicdomain/zero/1.0/>.
#
# @author Mike Bland (michael.bland@gsa.gov)

require_relative "test_helper"
require_relative "../_plugins/canonicalizer"

require "minitest/autorun"

module Hub
class CanonicalizeTest < ::Minitest::Test
def test_no_changes_needed
result = Canonicalizer.canonicalize "service"
assert_equal(result, "service")
end

def test_space_is_replaced
result = Canonicalizer.canonicalize "public service"
assert_equal(result, "public-service")
end

def test_multiple_spaces_are_replaced_once
result = Canonicalizer.canonicalize "public service"
assert_equal(result, "public-service")
end
end
end
29 changes: 29 additions & 0 deletions _test/canonicalizer_hyphenate_date_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# 18F Hub - Docs & connections between team members, projects, and skill sets
#
# Written in 2016 by Catherine Devlin (catherine.devlin@gsa.gov)
# on behalf of the 18F team, part of the US General Services Administration:
# https://18f.gsa.gov/
#
# To the extent possible under law, the author(s) have dedicated all copyright
# and related and neighboring rights to this software to the public domain
# worldwide. This software is distributed without any warranty.
#
# You should have received a copy of the CC0 Public Domain Dedication along
# with this software. If not, see
# <https://creativecommons.org/publicdomain/zero/1.0/>.
#
# @author Catherine Devlin (catherine.devlin@gsa.gov)

require_relative "test_helper"
require_relative "../_plugins/canonicalizer"

require "minitest/autorun"

module Hub
class HyphenateDateTest < ::Minitest::Test
def test_string_hyphenated
result = Canonicalizer.hyphenate_yyyymmdd "20170202"
assert_equal(result, "2017-02-02")
end
end
end

0 comments on commit 4dfd68d

Please sign in to comment.