Closed kaustavdm closed 9 years ago
@kumarrishav Wanna take this up?
@kaustavdm yeah sure :)
@kumarrishav go ahead!
@kumarrishav Added 2 more test cases. Check issue description.
@kaustavdm
var finder = new Applait.Finder({ hidden: true, searchkey: "ttt"});
var matchname = finder.matchname(".1.jpg", "/sdcard/DCIM/100MZLLA/.1.jpg"); expect(matchname).toBe(true);
expected result is not changing by changing searchkey? why it's happening.
seems i got the solution, will discuss after submitting PR
@kumarrishav Please refer to the updated issue description. Sorry for the goof up. This should make the relation between matchname
and checkhidden
clearer in the test.
@kaustavdm indirectly this is same as before. for the checkhidden to be true or false..it depends on both this.hidden as well as file is hidden or not. then for checkhidden, what case should i take ? I will suggest, simply change the description in previous PR (like searchkey matches and this.checkhidden() is true/false) because previous PR has all the cases.
@kumarrishav matchname
depends on checkhidden
. So, it is not reliable to test just this.hidden
. checkhidden
does other tests as well. So, the idea is, within your test, overwrite the checkhidden
method, just for that instance, with a custom function that just returns true
or false
depending on the usecase that you want to test.
Something like this:
var finder = new Applait.Finder();
// Overwrite checkhidden to return just true
finder.checkhidden = function () {
return true;
};
finder.casesensitive = true;
finder.matchname("Aa.jpg", "/sdcard/100Mozilla/Aa.jpg");
// Overwrite checkhidden to return just false
finder.checkhidden = function () {
return false;
};
// Test matchname again
Makes sense?
true
ifsearchkey
matches andthis.checkhidden()
istrue
.false
ifsearchkey
matches andthis.checkhidden()
isfalse
.this.casesensitive
istrue
.this.casesensitive
isfalse
.