-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added _calcChainableHelper for mvOverlapExpression and mvContainsExpr…
…ession (#279) * added _calcChainableHelper for mvOverlapExpression and mvContainsExpression * added mvOverlapExpression test * previous logic for mvContains and mvOverlap was flipped, corrected now; added mvContainsExpression test * review feedback
- Loading branch information
Showing
4 changed files
with
119 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
* Copyright 2012-2015 Metamarkets Group Inc. | ||
* Copyright 2015-2020 Imply Data, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
const { expect } = require('chai'); | ||
|
||
const plywood = require('../plywood'); | ||
|
||
const { Expression } = plywood; | ||
|
||
describe('MvContainsExpression', () => { | ||
describe('_calcChainableHelper', () => { | ||
it('works with single string', () => { | ||
const mvContainsExpression = Expression._.mvContains([ | ||
'thing', | ||
'otherThing', | ||
'otherOtherThing', | ||
]); | ||
|
||
expect(mvContainsExpression._calcChainableHelper('thing')).to.equal(true); | ||
expect(mvContainsExpression._calcChainableHelper('not a thing')).to.equal(false); | ||
}); | ||
|
||
it('works with array of strings', () => { | ||
const mvContainsExpression = Expression._.mvContains([ | ||
'thing', | ||
'otherThing', | ||
'otherOtherThing', | ||
]); | ||
|
||
expect(mvContainsExpression._calcChainableHelper(['thing', 'otherThing'])).to.equal(true); | ||
expect(mvContainsExpression._calcChainableHelper(['thing', 'not a thing'])).to.equal(false); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
* Copyright 2012-2015 Metamarkets Group Inc. | ||
* Copyright 2015-2020 Imply Data, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
const { expect } = require('chai'); | ||
|
||
const plywood = require('../plywood'); | ||
|
||
const { Expression } = plywood; | ||
|
||
describe('MvOverlapExpression', () => { | ||
describe('_calcChainableHelper', () => { | ||
it('works with single string', () => { | ||
const mvOverlapExpression = Expression._.mvOverlap([ | ||
'thing', | ||
'otherThing', | ||
'otherOtherThing', | ||
]); | ||
|
||
expect(mvOverlapExpression._calcChainableHelper('thing')).to.equal(true); | ||
expect(mvOverlapExpression._calcChainableHelper('not a thing')).to.equal(false); | ||
}); | ||
|
||
it('works with array of strings', () => { | ||
const mvOverlapExpression = Expression._.mvOverlap([ | ||
'thing', | ||
'otherThing', | ||
'otherOtherThing', | ||
]); | ||
|
||
expect(mvOverlapExpression._calcChainableHelper(['thing', 'otherThing'])).to.equal(true); | ||
expect(mvOverlapExpression._calcChainableHelper(['not a thing'])).to.equal(false); | ||
expect(mvOverlapExpression._calcChainableHelper(['thing', 'not a thing'])).to.equal(true); | ||
}); | ||
}); | ||
}); |