Skip to content

Commit

Permalink
fix failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Seth Pollack committed Feb 12, 2015
1 parent 380967a commit a1bf7ae
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions test/slug.test.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,17 @@ describe 'slug', ->
[slug 'foo- bar baz'].should.eql ['foo-bar-baz']
[slug 'foo] bar baz'].should.eql ['foo-bar-baz']

it 'should leave allowed chars', ->
it 'should leave allowed chars in rfc3986 mode', ->
slug.defaults.mode = 'rfc3986'
allowed = ['.', '_', '~']
for a in allowed
[slug "foo #{a} bar baz"].should.eql ["foo-#{a}-bar-baz"]
slug.defaults.mode = 'pretty'

it 'should leave allowed chars in pretty mode', ->
allowed = ['_', '~']
for a in allowed
[slug "foo #{a} bar baz"].should.eql ["foo-#{a}-bar-baz"]

it 'should replace latin chars', ->
char_map = {
Expand Down Expand Up @@ -121,7 +128,9 @@ describe 'slug', ->
replacement = replacement.replace ' ', '-'
[slug "foo #{char} bar baz"].should.eql ["foo-#{replacement}-bar-baz"]


it 'should replace symbols', ->
slug.defaults.mode = 'rfc3986'
char_map = {
'©':'c', 'œ': 'oe', 'Œ': 'OE', '': 'sum', '®': 'r',
'': 'd', 'ƒ': 'f', '': 'tm',
Expand All @@ -131,7 +140,11 @@ describe 'slug', ->
}
for char, replacement of char_map
[slug "foo #{char} bar baz"].should.eql ["foo-#{replacement}-bar-baz"]

slug.defaults.mode = 'pretty'

it 'should strip … symbols in pretty mode', ->
[slug "foo … bar baz"].should.eql ["foo-bar-baz"]

it 'should strip symbols', ->
char_map = [
'', '', '', '', '', ''
Expand Down

0 comments on commit a1bf7ae

Please sign in to comment.