|
| 1 | + |
| 2 | +constexpect=require('chai').expect |
| 3 | + |
| 4 | +describe('filter tests',()=>{ |
| 5 | + |
| 6 | +it('should pick the even numbers ',()=>{ |
| 7 | +letnumbers=[1,2,3,4,5,6,7,8,9,10] |
| 8 | +// your code goes here |
| 9 | +expect(results).to.deep.equal([2,4,6,8,10]) |
| 10 | +}); |
| 11 | + |
| 12 | +it('should pick the odd numbers ',()=>{ |
| 13 | +letnumbers=[1,2,3,4,5,6,7,8,9,10] |
| 14 | + |
| 15 | +// your code goes here |
| 16 | + |
| 17 | +expect(results).to.deep.equal([1,3,5,7,9]) |
| 18 | +}); |
| 19 | + |
| 20 | +it('should pick wordfs with three letteres ',()=>{ |
| 21 | +letwords=["pill","bad","finger","cat","blue","dog","table","red"] |
| 22 | + |
| 23 | +// your code goes here |
| 24 | + |
| 25 | +expect(results).to.deep.equal(["bad","cat","dog","red"]) |
| 26 | +}); |
| 27 | + |
| 28 | +it('should pick arrays only',()=>{ |
| 29 | +letelements=["CAT",["dog"],23,[56,3,8],"AIMLESS",43,"butter"] |
| 30 | + |
| 31 | +// your code goes here |
| 32 | + |
| 33 | +expect(results).to.deep.equal([["dog"],[56,3,8]]) |
| 34 | +}); |
| 35 | + |
| 36 | +it('should remove specific array from object',()=>{ |
| 37 | +lethuman={name:'yung-jhun',songs:[['cool song 1',50],['cool song 2',100],['cool song 3',90]]} |
| 38 | +lettracker={person:human} |
| 39 | +letsaying='cool song 2' |
| 40 | + |
| 41 | +// your code goes here. |
| 42 | + |
| 43 | +expect(human.songs).to.deep.equal([['cool song 1',50],['cool song 3',90]]) |
| 44 | +}); |
| 45 | + |
| 46 | +it('should filter based off of strings from user ',()=>{ |
| 47 | +letuserString='su' |
| 48 | +letmessages=[{user:'louisa',message:'haaaaa'}, |
| 49 | +{user:'yung-jhun',message:'kewl dude'}, |
| 50 | +{user:'alter-nate',message:'suh kewl'}, |
| 51 | +{user:'meeka',message:'adfasuhlkj'}, |
| 52 | +{user:'robbie',message:'im super loud'}] |
| 53 | + |
| 54 | +// your code goes here |
| 55 | + |
| 56 | +expect(results).to.deep.equal([{user:'alter-nate',message:'suh kewl'}, |
| 57 | +{user:'meeka',message:'adfasuhlkj'}, |
| 58 | +{user:'robbie',message:'im super loud'}]) |
| 59 | +}); |
| 60 | + |
| 61 | +it('should return the correct ids',()=>{ |
| 62 | +letdata=[{account:'person 1',id:'00112'}, |
| 63 | +{account:'person 2',id:'00045'}, |
| 64 | +{account:'person 3',id:'12309'}, |
| 65 | +{account:'person 4',id:'55931'}, |
| 66 | +{account:'person 5',id:'90215'}]; |
| 67 | + |
| 68 | +letids=['00112','90215','12309'] |
| 69 | + |
| 70 | +// your code goes here |
| 71 | + |
| 72 | +expect(results).to.deep.equal([{account:'person 1',id:'00112'}, |
| 73 | +{account:'person 3',id:'12309'}, |
| 74 | +{account:'person 5',id:'90215'}]) |
| 75 | +}); |
| 76 | + |
| 77 | +}); |