Skip to content
GitLab
Explore
Projects
Groups
Topics
Snippets
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Register
Sign in
Toggle navigation
Menu
UPSMF
program-service
Commits
12c777cf
Commit
12c777cf
authored
3 years ago
by
snehar-nd
Browse files
Options
Download
Patches
Plain Diff
Added test cases for "CSV generation"
parent
3ebf4dab
release-5.1.0
dependabot/npm_and_yarn/src/async-2.6.4
dependabot/npm_and_yarn/src/axios-0.21.2
dependabot/npm_and_yarn/src/decode-uri-component-0.2.2
dependabot/npm_and_yarn/src/jsonwebtoken-9.0.0
dependabot/npm_and_yarn/src/lodash-4.17.21
dependabot/npm_and_yarn/src/moment-2.29.4
dependabot/npm_and_yarn/src/moment-timezone-0.5.37
dependabot/npm_and_yarn/src/node-fetch-2.6.7
dependabot/npm_and_yarn/src/qs-and-body-parser-and-express-6.5.3
dependabot/npm_and_yarn/src/redis-3.1.1
dependabot/npm_and_yarn/src/simple-get-2.8.2
dependabot/npm_and_yarn/src/underscore-1.12.1
master
release-4.7.0
release-4.8.0
release-4.9.0
release-5.1.0_RC1
release-4.9.0_RC1
release-4.8.0_RC3
release-4.8.0_RC2
release-4.8.0_RC1
release-4.7.0_RC6
release-4.7.0_RC5
release-4.7.0_RC4
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/service/print/csv.js
+0
-1
src/service/print/csv.js
src/test/service/printService.js
+20
-3
src/test/service/printService.js
with
20 additions
and
4 deletions
+20
-4
src/service/print/csv.js
+
0
−
1
View file @
12c777cf
...
...
@@ -136,7 +136,6 @@ const buildCSVWithCallback = async (id, callback) => {
}
})
.
catch
((
e
)
=>
{
console
.
log
(
e
);
error
=
true
;
errorMsg
=
""
;
callback
(
null
,
error
,
errorMsg
,
null
);
...
...
This diff is collapsed.
Click to expand it.
src/test/service/printService.js
+
20
−
3
View file @
12c777cf
...
...
@@ -18,6 +18,7 @@ const dataImporter1 = rewire(
const
docx
=
rewire
(
"
../../service/print/docx.js
"
);
const
docx1
=
rewire
(
"
../../service/print/printDocxV1.0/docx.js
"
);
const
csv
=
rewire
(
"
../../service/print/csv.js
"
)
const
getQuestionForSection
=
dataImporter
.
__get__
(
"
getQuestionForSection
"
);
const
getItemsFromItemset
=
dataImporter
.
__get__
(
"
getItemsFromItemset
"
);
...
...
@@ -113,7 +114,7 @@ describe("Print Service", () => {
});
it
(
"
[Integration test] should getData for correct Hierarchy ID
"
,
(
done
)
=>
{
getData
(
"
do_113
41790341271552011559
"
)
getData
(
"
do_113
26731857693900818
"
)
.
then
((
response
)
=>
{
expect
(
response
).
to
.
not
.
be
.
undefined
;
expect
(
response
).
to
.
have
.
property
(
"
paperData
"
);
...
...
@@ -160,14 +161,14 @@ describe("Print Service", () => {
});
});
it
(
"
[Integration test] docx1.0 should return and error for incorrect Hierarchy ID
"
,
(
done
)
=>
{
getQuestionSet
(
"
do_11341847729268326411897
"
)
getQuestionSet
(
"
any
"
)
.
then
((
response
)
=>
{
expect
(
response
).
to
.
not
.
be
.
undefined
;
done
();
})
.
catch
((
e
)
=>
{
expect
(
e
.
name
).
to
.
equal
(
"
DocxDataImportError
"
);
expect
(
e
.
message
).
to
.
equal
(
"
Invalid Response for
Itemset
ID :: any
"
);
expect
(
e
.
message
).
to
.
equal
(
"
Invalid Response for
Hierarchy
ID :: any
"
);
done
();
});
});
...
...
@@ -216,6 +217,22 @@ describe("Print Service", () => {
done
();
});
});
it
(
"
[Integration test] generate CSV correct CSV Hierarchy ID
"
,
(
done
)
=>
{
csv
.
buildCSVWithCallback
(
"
do_113469567867748352166
"
,
(
base64
,
error
,
errorMsg
)
=>
{
expect
(
error
).
to
.
be
.
false
;
expect
(
errorMsg
).
to
.
equal
(
""
);
done
();
});
})
it
(
"
[Integration test] throw error for incorrect CSV Hierarchy ID
"
,
(
done
)
=>
{
csv
.
buildCSVWithCallback
(
"
any
"
,
(
base64
,
error
,
errorMsg
)
=>
{
expect
(
error
).
to
.
be
.
true
;
expect
(
errorMsg
).
to
.
equal
(
"
Uncaught Exception
"
);
done
();
});
});
it
(
"
Should parse table
"
,
(
done
)
=>
{
const
table
=
`<p>Match the following:</p><figure class="table"><table><tbody><tr><td><strong>Column 1</strong></td><td><strong>Column 2</strong></td></tr><tr><td>1</td><td>1</td></tr></tbody></table></figure>`
;
$
=
cheerio
.
load
(
table
);
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Topics
Snippets