Skip to content

Commit 33cac65

Browse files
committed
added tests for svgs
1 parent dd1e61e commit 33cac65

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

‎__test__/index.test.js‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
constaxios=require('axios');
22
const{ queryOptions, calendarData }=require('../src/utils');
33
const{ createGraph }=require('../src/createChart');
4+
const{ graphSvg, invalidUserSvg }=require('../src/svgs');
45

56
const{
67
fakeQueryString,
78
fakeQueryStringRes,
9+
fakeGraphArgs,
810
options,
911
}=require('./inputs.index');
1012

@@ -34,3 +36,11 @@ it('Graph Generation', async () =>{
3436
});
3537
expect(graph).toEqual(expect.any(String));
3638
});
39+
40+
//- Svg testing ✔
41+
it('Test SVGs',()=>{
42+
letfakeInvalidSvgArg='User not found!';
43+
expect.assertions(2);
44+
expect(graphSvg(fakeGraphArgs)).toEqual(expect.any(String));
45+
expect(invalidUserSvg(fakeInvalidSvgArg)).toEqual(expect.any(String));
46+
});

‎__test__/inputs.index.js‎

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,14 @@ let fakeQueryStringRes = [
9797
},
9898
];
9999

100+
letfakeGraphArgs={
101+
height: 10,
102+
width: 20,
103+
colors: 'red',
104+
title: 'graphSvg',
105+
line: 'line',
106+
};
107+
100108
letoptions={
101109
width: this.width,
102110
height: this.height,
@@ -125,4 +133,9 @@ let options ={
125133
fullWidth: true,
126134
};
127135

128-
module.exports={ fakeQueryString, fakeQueryStringRes, options };
136+
module.exports={
137+
fakeQueryString,
138+
fakeQueryStringRes,
139+
fakeGraphArgs,
140+
options,
141+
};

0 commit comments

Comments
(0)