Skip to content

Commit 8f2da81

Browse files
committed
test: clean test for contains operator
Signed-off-by: Miroslav Bajtoš <[email protected]>
1 parent 1264555 commit 8f2da81

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

test/postgresql.test.js

+14-6
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ describe('postgresql connector', function() {
7373
dataType: 'varchar[]',
7474
},
7575
},
76-
});
76+
}, {allowExtendedOperators: true});
7777
created = new Date();
7878
});
7979

@@ -264,15 +264,23 @@ describe('postgresql connector', function() {
264264
});
265265

266266
it('should support where filter for array type field', async () => {
267-
Post.dataSource.settings.allowExtendedOperators = true;
268-
const post = await Post.find({where: {and: [
267+
await Post.create({
268+
title: 'LoopBack Participates in Hacktoberfest',
269+
categories: ['LoopBack', 'Announcements'],
270+
});
271+
await Post.create({
272+
title: 'Growing LoopBack Community',
273+
categories: ['LoopBack', 'Community'],
274+
});
275+
276+
const found = await Post.find({where: {and: [
269277
{
270-
categories: {'contains': ['AA']},
278+
categories: {'contains': ['LoopBack', 'Community']},
271279
},
272280
]}});
273-
should.exist(post);
274-
post.length.should.equal(1);
281+
found.map(p => p.title).should.deepEqual(['Growing LoopBack Community']);
275282
});
283+
276284
it('should support boolean types with false value', function(done) {
277285
Post.create(
278286
{title: 'T2', content: 'C2', approved: false, created: created},

0 commit comments

Comments
 (0)