|
| 1 | +local twelve_days = require('twelve-days') |
| 2 | + |
| 3 | +describe('twelve-days', function() |
| 4 | + describe('verse', function() |
| 5 | + it('first day a partridge in a pear tree', function() |
| 6 | + local expected = { 'On the first day of Christmas my true love gave to me: a Partridge in a Pear Tree.' } |
| 7 | + assert.are.same(expected, twelve_days.recite(1, 1)) |
| 8 | + end) |
| 9 | + |
| 10 | + it('second day two turtle doves', function() |
| 11 | + local expected = { |
| 12 | + 'On the second day of Christmas my true love gave to me: two Turtle Doves, and a Partridge in a Pear Tree.' |
| 13 | + } |
| 14 | + assert.are.same(expected, twelve_days.recite(2, 2)) |
| 15 | + end) |
| 16 | + |
| 17 | + it('third day three french hens', function() |
| 18 | + local expected = { |
| 19 | + 'On the third day of Christmas my true love gave to me: three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.' |
| 20 | + } |
| 21 | + assert.are.same(expected, twelve_days.recite(3, 3)) |
| 22 | + end) |
| 23 | + |
| 24 | + it('fourth day four calling birds', function() |
| 25 | + local expected = { |
| 26 | + 'On the fourth day of Christmas my true love gave to me: four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.' |
| 27 | + } |
| 28 | + assert.are.same(expected, twelve_days.recite(4, 4)) |
| 29 | + end) |
| 30 | + |
| 31 | + it('fifth day five gold rings', function() |
| 32 | + local expected = { |
| 33 | + 'On the fifth day of Christmas my true love gave to me: five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.' |
| 34 | + } |
| 35 | + assert.are.same(expected, twelve_days.recite(5, 5)) |
| 36 | + end) |
| 37 | + |
| 38 | + it('sixth day six geese-a-laying', function() |
| 39 | + local expected = { |
| 40 | + 'On the sixth day of Christmas my true love gave to me: six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.' |
| 41 | + } |
| 42 | + assert.are.same(expected, twelve_days.recite(6, 6)) |
| 43 | + end) |
| 44 | + |
| 45 | + it('seventh day seven swans-a-swimming', function() |
| 46 | + local expected = { |
| 47 | + 'On the seventh day of Christmas my true love gave to me: seven Swans-a-Swimming, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.' |
| 48 | + } |
| 49 | + assert.are.same(expected, twelve_days.recite(7, 7)) |
| 50 | + end) |
| 51 | + |
| 52 | + it('eighth day eight maids-a-milking', function() |
| 53 | + local expected = { |
| 54 | + 'On the eighth day of Christmas my true love gave to me: eight Maids-a-Milking, seven Swans-a-Swimming, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.' |
| 55 | + } |
| 56 | + assert.are.same(expected, twelve_days.recite(8, 8)) |
| 57 | + end) |
| 58 | + |
| 59 | + it('ninth day nine ladies dancing', function() |
| 60 | + local expected = { |
| 61 | + 'On the ninth day of Christmas my true love gave to me: nine Ladies Dancing, eight Maids-a-Milking, seven Swans-a-Swimming, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.' |
| 62 | + } |
| 63 | + assert.are.same(expected, twelve_days.recite(9, 9)) |
| 64 | + end) |
| 65 | + |
| 66 | + it('tenth day ten lords-a-leaping', function() |
| 67 | + local expected = { |
| 68 | + 'On the tenth day of Christmas my true love gave to me: ten Lords-a-Leaping, nine Ladies Dancing, eight Maids-a-Milking, seven Swans-a-Swimming, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.' |
| 69 | + } |
| 70 | + assert.are.same(expected, twelve_days.recite(10, 10)) |
| 71 | + end) |
| 72 | + |
| 73 | + it('eleventh day eleven pipers piping', function() |
| 74 | + local expected = { |
| 75 | + 'On the eleventh day of Christmas my true love gave to me: eleven Pipers Piping, ten Lords-a-Leaping, nine Ladies Dancing, eight Maids-a-Milking, seven Swans-a-Swimming, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.' |
| 76 | + } |
| 77 | + assert.are.same(expected, twelve_days.recite(11, 11)) |
| 78 | + end) |
| 79 | + |
| 80 | + it('twelfth day twelve drummers drumming', function() |
| 81 | + local expected = { |
| 82 | + 'On the twelfth day of Christmas my true love gave to me: twelve Drummers Drumming, eleven Pipers Piping, ten Lords-a-Leaping, nine Ladies Dancing, eight Maids-a-Milking, seven Swans-a-Swimming, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.' |
| 83 | + } |
| 84 | + assert.are.same(expected, twelve_days.recite(12, 12)) |
| 85 | + end) |
| 86 | + end) |
| 87 | + |
| 88 | + describe('lyrics', function() |
| 89 | + it('recites first three verses of the song', function() |
| 90 | + local expected = { |
| 91 | + 'On the first day of Christmas my true love gave to me: a Partridge in a Pear Tree.', |
| 92 | + 'On the second day of Christmas my true love gave to me: two Turtle Doves, and a Partridge in a Pear Tree.', |
| 93 | + 'On the third day of Christmas my true love gave to me: three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.' |
| 94 | + } |
| 95 | + assert.are.same(expected, twelve_days.recite(1, 3)) |
| 96 | + end) |
| 97 | + |
| 98 | + it('recites three verses from the middle of the song', function() |
| 99 | + local expected = { |
| 100 | + 'On the fourth day of Christmas my true love gave to me: four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.', |
| 101 | + 'On the fifth day of Christmas my true love gave to me: five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.', |
| 102 | + 'On the sixth day of Christmas my true love gave to me: six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.' |
| 103 | + } |
| 104 | + assert.are.same(expected, twelve_days.recite(4, 6)) |
| 105 | + end) |
| 106 | + |
| 107 | + it('recites the whole song', function() |
| 108 | + local expected = { |
| 109 | + 'On the first day of Christmas my true love gave to me: a Partridge in a Pear Tree.', |
| 110 | + 'On the second day of Christmas my true love gave to me: two Turtle Doves, and a Partridge in a Pear Tree.', |
| 111 | + 'On the third day of Christmas my true love gave to me: three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.', |
| 112 | + 'On the fourth day of Christmas my true love gave to me: four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.', |
| 113 | + 'On the fifth day of Christmas my true love gave to me: five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.', |
| 114 | + 'On the sixth day of Christmas my true love gave to me: six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.', |
| 115 | + 'On the seventh day of Christmas my true love gave to me: seven Swans-a-Swimming, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.', |
| 116 | + 'On the eighth day of Christmas my true love gave to me: eight Maids-a-Milking, seven Swans-a-Swimming, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.', |
| 117 | + 'On the ninth day of Christmas my true love gave to me: nine Ladies Dancing, eight Maids-a-Milking, seven Swans-a-Swimming, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.', |
| 118 | + 'On the tenth day of Christmas my true love gave to me: ten Lords-a-Leaping, nine Ladies Dancing, eight Maids-a-Milking, seven Swans-a-Swimming, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.', |
| 119 | + 'On the eleventh day of Christmas my true love gave to me: eleven Pipers Piping, ten Lords-a-Leaping, nine Ladies Dancing, eight Maids-a-Milking, seven Swans-a-Swimming, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.', |
| 120 | + 'On the twelfth day of Christmas my true love gave to me: twelve Drummers Drumming, eleven Pipers Piping, ten Lords-a-Leaping, nine Ladies Dancing, eight Maids-a-Milking, seven Swans-a-Swimming, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.' |
| 121 | + } |
| 122 | + assert.are.same(expected, twelve_days.recite(1, 12)) |
| 123 | + end) |
| 124 | + end) |
| 125 | +end) |
0 commit comments