2019-05-02 17:17:27 -05:00
# frozen_string_literal: true
2023-01-07 05:53:14 -06:00
require " minitest/autorun "
require_relative " ../create_title.rb "
2016-05-26 01:54:38 -05:00
class TestCreateTitle < Minitest :: Test
def test_create_title_1
2023-01-07 05:53:14 -06:00
body =
" @GreatCheerThreading \n Where can I find information on how GCTS stacks up against the competition? What are the key differentiators? "
2016-05-26 01:54:38 -05:00
expected = " Where can I find information on how GCTS stacks up against the competition? "
title = CreateTitle . from_body body
assert_equal ( expected , title )
end
def test_create_title_2
2023-01-07 05:53:14 -06:00
body =
" GCTS in 200 stores across town. How many threads per inch would you guess? @GreatCheerThreading "
2016-05-26 01:54:38 -05:00
expected = " GCTS in 200 stores across town. How many threads per inch would you guess? "
title = CreateTitle . from_body body
assert_equal ( expected , title )
end
def test_create_title_3
2023-01-07 05:53:14 -06:00
body =
" gFabric Sheets 1.2 now has Great Cheer Threads, letting you feel the softness running through the cotton fibers. "
2016-05-26 01:54:38 -05:00
expected = " gFabric Sheets 1.2 now has Great Cheer Threads, letting you feel the softness... "
title = CreateTitle . from_body body
assert_equal ( expected , title )
end
def test_create_title_4
body = " Great Cheer Threads® for GCTS Platinum Partners | \n Rules And Spools "
expected = " Great Cheer Threads® for GCTS Platinum Partners "
title = CreateTitle . from_body body
assert_equal ( expected , title )
end
def test_create_title_5
2023-01-07 05:53:14 -06:00
body =
" One sentence. Two sentence. Three sentence. Four is going to go on and on for more words than we want. "
2016-05-26 01:54:38 -05:00
expected = " One sentence. Two sentence. Three sentence. "
title = CreateTitle . from_body body
assert_equal ( expected , title )
end
def test_create_title_6
2023-01-07 05:53:14 -06:00
body =
" Anyone know of any invite codes for www.greatcheer.io (the Great Cheer v2 site)? \n \n //cc @RD @GreatCheerThreading "
2016-05-26 01:54:38 -05:00
expected = " Anyone know of any invite codes for www.greatcheer.io (the Great Cheer v2 site)? "
title = CreateTitle . from_body body
assert_equal ( expected , title )
end
def test_create_title_6b
2023-01-07 05:53:14 -06:00
body =
" Anyone know of any invite codes for www.greatcheer.io (the Great Cheer v2 site of yore)? \n \n //cc @RD @GreatCheerThreading "
2016-05-26 01:54:38 -05:00
expected = " Anyone know of any invite codes for www.greatcheer.io (the Great Cheer v2 site... "
title = CreateTitle . from_body body
assert_equal ( expected , title )
end
def test_create_title_6c
2023-01-07 05:53:14 -06:00
body =
" Anyone know of any invite codes for www.greatcheer.io?! (the Great Cheer v2 site of yore)? \n \n //cc @RD @GreatCheerThreading "
2016-05-26 01:54:38 -05:00
expected = " Anyone know of any invite codes for www.greatcheer.io?! "
title = CreateTitle . from_body body
assert_equal ( expected , title )
end
def test_create_title_7
2023-01-07 05:53:14 -06:00
body =
" @GreatCheerThreading \n \n Does anyone know what the plan is to move to denser 1.2 threads for GCTS? \n \n I have a customer interested in the higher thread counts offered in 1.2. "
2016-05-26 01:54:38 -05:00
expected = " Does anyone know what the plan is to move to denser 1.2 threads for GCTS? "
title = CreateTitle . from_body body
assert_equal ( expected , title )
end
def test_create_title_8
2023-01-07 05:53:14 -06:00
body =
" @GreatCheerThreading @FabricWeavingWorldwide \n \n I was just chatting with a customer, after receiving this email: \n \n \" Ours is more of a ‘ conceptual’ question. We have too much fiber "
2016-05-26 01:54:38 -05:00
expected = " I was just chatting with a customer, after receiving this email: "
title = CreateTitle . from_body body
assert_equal ( expected , title )
end
def test_create_title_9
2023-01-07 05:53:14 -06:00
body =
" Hi, \n \n Does anyone have a PPT deck on whats new in cotton (around 10 or so slides) nothing to detailed as per what we have in the current 1.x version? \n \n I am not after a what's coming in cotton 2 "
2016-05-26 01:54:38 -05:00
expected = " Does anyone have a PPT deck on whats new in cotton (around 10 or so slides)... "
title = CreateTitle . from_body body
assert_equal ( expected , title )
end
def test_create_title_10
body = " foo \n bar \n baz "
expected = nil
title = CreateTitle . from_body body
assert_equal ( expected , title )
end
def test_create_title_11
2023-01-07 05:53:14 -06:00
body =
" Hi Guys, \n I'm working with # gtcs and one of the things we're playing with is TC. What better tool to demo and use than our own \n https://greatcheerthreading.com/themostthreads/cool-stuff \n \n This used to work great in 2013, "
2016-05-26 01:54:38 -05:00
expected = " I'm working with # gtcs and one of the things we're playing with is TC. "
title = CreateTitle . from_body body
assert_equal ( expected , title )
end
def test_create_title_12
body = " "
expected = nil
title = CreateTitle . from_body body
assert_equal ( expected , title )
end
def test_create_title_13
2023-01-07 05:53:14 -06:00
body =
" Embroidered TC ... http://blogs.greatcheerthreading.com/thread/embroidering-the-threads-is-just-the-beginning \n @SoftStuff @TightWeave and team hopefully can share their thoughts on this recent post. "
2016-05-26 01:54:38 -05:00
expected = " and team hopefully can share their thoughts on this recent post. "
title = CreateTitle . from_body body
assert_equal ( expected , title )
end
end