Skip to content

Commit cf26321

Browse files
committed
Updated post filter test bindings for normalized date format
The date-filter normalization rewrites bare date filter values to the stored `YYYY-MM-DD HH:MM:SS` format, so the existing query-binding assertions for `published_at:>'2015-07-20'` now expect `2015-07-20 00:00:00`.
1 parent 0e30bd3 commit cf26321

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

ghost/core/test/unit/server/models/post.test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,14 +115,14 @@ describe('Unit: models/post', function () {
115115
assert.equal(queries.length, 2);
116116
assert.equal(queries[0].sql, 'select count(distinct posts.id) as aggregate from `posts` where (`posts`.`published_at` > ? and (`posts`.`type` = ? and `posts`.`status` = ?))');
117117
assert.deepEqual(queries[0].bindings, [
118-
'2015-07-20',
118+
'2015-07-20 00:00:00',
119119
'post',
120120
'published'
121121
]);
122122

123123
assert.equal(queries[1].sql, 'select `posts`.* from `posts` where (`posts`.`published_at` > ? and (`posts`.`type` = ? and `posts`.`status` = ?)) order by CASE WHEN posts.status = \'scheduled\' THEN 1 WHEN posts.status = \'draft\' THEN 2 ELSE 3 END ASC,CASE WHEN posts.status != \'draft\' THEN posts.published_at END DESC,posts.updated_at DESC,posts.id DESC limit ?');
124124
assert.deepEqual(queries[1].bindings, [
125-
'2015-07-20',
125+
'2015-07-20 00:00:00',
126126
'post',
127127
'published',
128128
5
@@ -148,7 +148,7 @@ describe('Unit: models/post', function () {
148148
assert.equal(queries.length, 1);
149149
assert.equal(queries[0].sql, 'select `posts`.* from `posts` where (`posts`.`published_at` > ? and (`posts`.`type` = ? and `posts`.`status` = ?)) order by CASE WHEN posts.status = \'scheduled\' THEN 1 WHEN posts.status = \'draft\' THEN 2 ELSE 3 END ASC,CASE WHEN posts.status != \'draft\' THEN posts.published_at END DESC,posts.updated_at DESC,posts.id DESC limit ?');
150150
assert.deepEqual(queries[0].bindings, [
151-
'2015-07-20',
151+
'2015-07-20 00:00:00',
152152
'post',
153153
'published',
154154
1
@@ -176,7 +176,7 @@ describe('Unit: models/post', function () {
176176
assert.equal(queries.length, 1);
177177
assert.equal(queries[0].sql, 'select `posts`.* from `posts` where (`posts`.`published_at` > ? and (`posts`.`type` = ? and `posts`.`status` = ?)) order by CASE WHEN posts.status = \'scheduled\' THEN 1 WHEN posts.status = \'draft\' THEN 2 ELSE 3 END ASC,CASE WHEN posts.status != \'draft\' THEN posts.published_at END DESC,posts.updated_at DESC,posts.id DESC limit ?');
178178
assert.deepEqual(queries[0].bindings, [
179-
'2015-07-20',
179+
'2015-07-20 00:00:00',
180180
'post',
181181
'published',
182182
1

0 commit comments

Comments
 (0)