Skip to content

Commit c8a8ecd

Browse files
committed
test(hash): more tests for lib.hash
1 parent c23f71b commit c8a8ecd

File tree

1 file changed

+24
-3
lines changed

1 file changed

+24
-3
lines changed

test/github-theme/hash_spec.lua

+24-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
local hash = require('github-theme.lib.hash')
22

3-
describe('Hash', function()
3+
describe('hash()', function()
44
it('should produce same result with different table order', function()
55
local t1 = { Normal = { bg = '#192330', fg = '#cdcecf' } }
66
local t2 = { Normal = { fg = '#cdcecf', bg = '#192330' } }
7-
assert.is.same(hash(t1), hash(t2))
7+
assert.same(hash(t1), hash(t2))
88
end)
99

1010
it('should understand booleans', function()
@@ -30,6 +30,27 @@ describe('Hash', function()
3030
search = false,
3131
},
3232
}
33-
assert.is_not.same(hash(t1), hash(t2))
33+
assert.not_same(hash(t1), hash(t2))
34+
end)
35+
36+
it('should handle empty tables within (1)', function()
37+
assert.not_same(hash({}), hash({ k = {} }))
38+
assert.not_same(hash({}), hash({ key = {} }))
39+
end)
40+
41+
-- TODO: FAILING
42+
pending('should handle empty tables within (2)', function()
43+
assert.not_same(hash({ k = 0 }), hash({ k = {} }))
44+
assert.not_same(hash({ key = 0 }), hash({ key = {} }))
45+
end)
46+
47+
it('should handle empty tables within (3)', function()
48+
assert.not_same(hash({ k = '' }), hash({ k = {} }))
49+
assert.not_same(hash({ key = '' }), hash({ key = {} }))
50+
end)
51+
52+
it('should handle empty tables within (4)', function()
53+
assert.not_same(hash({ k = false }), hash({ k = {} }))
54+
assert.not_same(hash({ key = false }), hash({ key = {} }))
3455
end)
3556
end)

0 commit comments

Comments
 (0)