Skip to content
This repository has been archived by the owner on May 14, 2019. It is now read-only.

Commit

Permalink
style: Fix eslint prettier errors
Browse files Browse the repository at this point in the history
  • Loading branch information
sudo-suhas committed Oct 9, 2017
1 parent 043cb24 commit 7e2e801
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 15 deletions.
60 changes: 48 additions & 12 deletions test/condition.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,62 +47,98 @@ describe('Condition builder', () => {
});

it('sets the property key', () => {
const cn = new Condition().prop('my_prop').eq('dancing monkeys').build();
const cn = new Condition()
.prop('my_prop')
.eq('dancing monkeys')
.build();
expect(cn).toBe('["my_prop"] == "dancing monkeys"');
});

it('builds boolean condition', () => {
const cn = new Condition().prop('my_prop').is(true).build();
const cn = new Condition()
.prop('my_prop')
.is(true)
.build();
expect(cn).toBe('["my_prop"] is true');
});

it('builds equality condition', () => {
const cn = new Condition().prop('my_prop').eq('dancing monkeys').build();
const cn = new Condition()
.prop('my_prop')
.eq('dancing monkeys')
.build();
expect(cn).toBe('["my_prop"] == "dancing monkeys"');
});

it('builds inequality condition', () => {
const cn = new Condition().prop('my_prop').ne('dancing monkeys').build();
const cn = new Condition()
.prop('my_prop')
.ne('dancing monkeys')
.build();
expect(cn).toBe('["my_prop"] != "dancing monkeys"');
});

it('builds less than condition', () => {
const cn = new Condition().prop('my_prop').lt(299792458).build();
const cn = new Condition()
.prop('my_prop')
.lt(299792458)
.build();
expect(cn).toBe('["my_prop"] < 299792458');
});

it('builds less than or equal to condition', () => {
const cn = new Condition().prop('my_prop').lte(299792458).build();
const cn = new Condition()
.prop('my_prop')
.lte(299792458)
.build();
expect(cn).toBe('["my_prop"] <= 299792458');
});

it('builds greater than condition', () => {
const cn = new Condition().prop('my_prop').gt(299792458).build();
const cn = new Condition()
.prop('my_prop')
.gt(299792458)
.build();
expect(cn).toBe('["my_prop"] > 299792458');
});

it('builds greater than or equal to condition', () => {
const cn = new Condition().prop('my_prop').gte(299792458).build();
const cn = new Condition()
.prop('my_prop')
.gte(299792458)
.build();
expect(cn).toBe('["my_prop"] >= 299792458');
});

it('builds property exists condition', () => {
const cn = new Condition().prop('one_piece').exists().build();
const cn = new Condition()
.prop('one_piece')
.exists()
.build();
expect(cn).toBe('["one_piece"] exists');
});

it('builds property missing condition', () => {
const cn = new Condition().prop('the_last_airbender').missing().build();
const cn = new Condition()
.prop('the_last_airbender')
.missing()
.build();
expect(cn).toBe('["the_last_airbender"] missing');
});

it('builds contains condition', () => {
const cn = new Condition().prop('potion').contains('magic').build();
const cn = new Condition()
.prop('potion')
.contains('magic')
.build();
expect(cn).toBe('["potion"] contains "magic"');
});

it('builds notcontains condition', () => {
const cn = new Condition().prop('anime').notContains('fillers').build();
const cn = new Condition()
.prop('anime')
.notContains('fillers')
.build();
expect(cn).toBe('["anime"] !contains "fillers"');
});

Expand Down
14 changes: 12 additions & 2 deletions test/parse.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,12 @@ describe('parse', () => {
test(`${cnNamesMap[cn1]} and ${cnNamesMap[cn2]} and ${cnNamesMap[
cn3
]}`, () => {
const qry = parse(muto.where(cnMap[cn1]).and(cnMap[cn2]).and(cnMap[cn3]));
const qry = parse(
muto
.where(cnMap[cn1])
.and(cnMap[cn2])
.and(cnMap[cn3])
);

expect(qry).toBeInstanceOf(bob.BoolQuery);
expect(qry).toEqual(
Expand All @@ -115,7 +120,12 @@ describe('parse', () => {
});

test(`${cnNamesMap[cn1]} or ${cnNamesMap[cn2]} or ${cnNamesMap[cn3]}`, () => {
const qry = parse(muto.where(cnMap[cn1]).or(cnMap[cn2]).or(cnMap[cn3]));
const qry = parse(
muto
.where(cnMap[cn1])
.or(cnMap[cn2])
.or(cnMap[cn3])
);

expect(qry).toBeInstanceOf(bob.BoolQuery);
expect(qry).toEqual(
Expand Down
5 changes: 4 additions & 1 deletion test/where.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ describe('Where builder', () => {
});

it('can handle nested conditions', () => {
const where = new Where(cn1).and(cn2).and(new Where(strCn1).or(strCn2)).build();
const where = new Where(cn1)
.and(cn2)
.and(new Where(strCn1).or(strCn2))
.build();
expect(where).toBe(
`(${cn1.build()} and ${cn2.build()} and (${strCn1} or ${strCn2}))`
);
Expand Down

0 comments on commit 7e2e801

Please sign in to comment.