Skip to content

Commit f8914b3

Browse files
committed
Created a unitTest helper function
This abstracts away a lot of the repetative stuff that would need to go into each file
1 parent 8d1ecfe commit f8914b3

File tree

3 files changed

+16
-6
lines changed

3 files changed

+16
-6
lines changed

gulp/helpers/unitTest.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import readFile from './readFile';
2+
3+
export default function unitTest (fileName, dir, expectedResult){
4+
test(fileName, ()=>{
5+
return readFile(`${dir}/${fileName}.css`).then(css => {
6+
expect( css ).toBe(expectedResult+'\n');
7+
})
8+
})
9+
}
10+
11+
//__dirname
Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
import readFile from '../../../gulp/helpers/readFile';
1+
import unitTest from '../../../gulp/helpers/unitTest';
22

3-
test('inside-height', ()=>{
4-
return readFile(__dirname+'/insideHeight.css').then(css => {
5-
expect( css ).toBe('@media (max-height: 800px) and (min-height: 601px){.unitTest{color:#000}}\n');
6-
})
7-
})
3+
unitTest('insideHeight', __dirname, '@media (max-height: 800px) and (min-height: 601px){.unitTest{color:#000}}')
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import unitTest from '../../../gulp/helpers/unitTest';
2+
3+
unitTest('insideHeightVar', __dirname, '@media (max-height: 800px) and (min-height: 601px){.unitTest{color:#000}}')

0 commit comments

Comments
 (0)