Skip to content

Commit

Permalink
test(test_resources/test_files): rename test files for better sorting (
Browse files Browse the repository at this point in the history
  • Loading branch information
Fdawgs committed May 29, 2023
1 parent 8032192 commit c5cc479
Show file tree
Hide file tree
Showing 34 changed files with 62 additions and 62 deletions.
8 changes: 4 additions & 4 deletions src/plugins/doc-to-txt/plugin.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ describe("DOC-to-TXT conversion plugin", () => {
headers: {
"content-type": "application/msword",
},
readFile: "./test_resources/test_files/valid_doc.doc",
readFile: "./test_resources/test_files/doc_valid.doc",
},
{
testName: "DOCX file to TXT",
headers: {
"content-type":
"application/vnd.openxmlformats-officedocument.wordprocessingml.document",
},
readFile: "./test_resources/test_files/valid_docx.docx",
readFile: "./test_resources/test_files/docx_valid.docx",
},
])("Converts $testName", async ({ headers, readFile }) => {
const response = await server.inject({
Expand Down Expand Up @@ -87,15 +87,15 @@ describe("DOC-to-TXT conversion plugin", () => {
headers: {
"content-type": "application/msword",
},
readFile: "./test_resources/test_files/invalid_doc.doc",
readFile: "./test_resources/test_files/doc_invalid.doc",
},
{
testName: "is not a valid DOCX file",
headers: {
"content-type":
"application/vnd.openxmlformats-officedocument.wordprocessingml.document",
},
readFile: "./test_resources/test_files/invalid_docx.docx",
readFile: "./test_resources/test_files/docx_invalid.docx",
},
])(
"Returns HTTP status code 400 if file $testName",
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/docx-to-html/plugin.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ describe("DOCX-to-HTML conversion plugin", () => {
method: "POST",
url: "/",
body: await fs.readFile(
"./test_resources/test_files/valid_docx.docx"
"./test_resources/test_files/docx_valid.docx"
),
headers: {
"content-type":
Expand Down Expand Up @@ -95,7 +95,7 @@ describe("DOCX-to-HTML conversion plugin", () => {
},
body: readFile
? await fs.readFile(
"./test_resources/test_files/invalid_docx.docx"
"./test_resources/test_files/docx_invalid.docx"
)
: undefined,
});
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/embed-html-images/plugin.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ describe("Embed-HTML-Images plugin", () => {
method: "POST",
url: "/",
body: await fs.readFile(
"./test_resources/test_files/valid_bullet_issues_html.html"
"./test_resources/test_files/html_valid_bullet_issues.html"
),
headers: {
"content-type": "text/html",
Expand All @@ -67,7 +67,7 @@ describe("Embed-HTML-Images plugin", () => {
method: "POST",
url: "/",
body: await fs.readFile(
"./test_resources/test_files/valid_bullet_issues_html.html"
"./test_resources/test_files/html_valid_bullet_issues.html"
),
headers: {
"content-type": "text/html",
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/html-to-txt/plugin.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ describe("HTML-to-TXT conversion plugin", () => {
method: "POST",
url: "/",
body: await fs.readFile(
"./test_resources/test_files/valid_html.html"
"./test_resources/test_files/html_valid.html"
),
headers: {
"content-type": "text/html",
Expand Down Expand Up @@ -79,7 +79,7 @@ describe("HTML-to-TXT conversion plugin", () => {
},
body: readFile
? await fs.readFile(
"./test_resources/test_files/invalid_html.html"
"./test_resources/test_files/html_invalid.html"
)
: undefined,
});
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/image-to-txt/plugin.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ describe("Image-to-TXT conversion plugin", () => {
method: "POST",
url: "/",
body: await fs.readFile(
"./test_resources/test_files/valid_bullet_issues001.png"
"./test_resources/test_files/png_valid_bullet_issues001.png"
),
headers: {
"content-type": "image/png",
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/pdf-to-html/plugin.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ describe("PDF-to-HTML conversion plugin", () => {
},
body: readFile
? await fs.readFile(
"./test_resources/test_files/invalid_pdf.pdf"
"./test_resources/test_files/pdf_invalid.pdf"
)
: undefined,
});
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/pdf-to-txt/plugin.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ describe("PDF-to-TXT conversion plugin", () => {
query,
body: readFile
? await fs.readFile(
"./test_resources/test_files/invalid_pdf.pdf"
"./test_resources/test_files/pdf_invalid.pdf"
)
: undefined,
});
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/rtf-to-html/plugin.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ describe("RTF-to-HTML conversion plugin", () => {
method: "POST",
url: "/",
body: await fs.readFile(
"./test_resources/test_files/valid_rtf.rtf"
"./test_resources/test_files/rtf_valid.rtf"
),
headers: {
"content-type": "application/rtf",
Expand Down Expand Up @@ -124,7 +124,7 @@ describe("RTF-to-HTML conversion plugin", () => {
},
body: readFile
? await fs.readFile(
"./test_resources/test_files/invalid_rtf.rtf"
"./test_resources/test_files/rtf_invalid.rtf"
)
: undefined,
});
Expand Down
18 changes: 9 additions & 9 deletions src/plugins/tidy-css/plugin.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,31 +31,31 @@ describe("Tidy-CSS plugin", () => {
it.each([
{
testName: "Tidies CSS in HTML",
file: "valid_bullet_issues_html.html",
file: "html_valid_bullet_issues.html",
expected: {
// Original font-family of test file
fonts: /font-family:Times/,
},
},
{
testName: "Tidies CSS in HTML and sets new font",
file: "valid_bullet_issues_html.html",
file: "html_valid_bullet_issues.html",
options: { fonts: "Arial" },
expected: {
fonts: /font-family:Arial/,
},
},
{
testName: "Tidies CSS in HTML and sets new font in quotation marks",
file: "valid_bullet_issues_html.html",
file: "html_valid_bullet_issues.html",
options: { fonts: 'Sans Serif, "Gill Sans"' },
expected: {
fonts: /Sans Serif","\\"Gill Sans\\"/,
},
},
{
testName: "Tidies CSS in HTML and sets new background color",
file: "valid_bullet_issues_html.html",
file: "html_valid_bullet_issues.html",
options: { backgroundColor: "white" },
expected: {
backgroundColor: /background-color:#fff/,
Expand All @@ -66,7 +66,7 @@ describe("Tidy-CSS plugin", () => {
{
testName:
"Tidies CSS in HTML, sets new background color, and sets new font",
file: "valid_bullet_issues_html.html",
file: "html_valid_bullet_issues.html",
options: { backgroundColor: "white", fonts: "Arial" },
expected: {
backgroundColor: /background-color:#fff/,
Expand All @@ -76,7 +76,7 @@ describe("Tidy-CSS plugin", () => {
{
testName:
"Creates new style element if none exist in HTML but query string params passed",
file: "valid_empty_html.html",
file: "html_valid_empty.html",
options: { fonts: "Arial", backgroundColor: "white" },
expected: {
fonts: /font-family:Arial/,
Expand All @@ -86,7 +86,7 @@ describe("Tidy-CSS plugin", () => {
{
testName:
"Continues to parse style elements with no type attribute in HTML",
file: "valid_no_style_type_html.html",
file: "html_valid_no_style_type.html",
},
])("$testName", async ({ expected, file, options }) => {
server.post("/", (req, res) => {
Expand Down Expand Up @@ -116,7 +116,7 @@ describe("Tidy-CSS plugin", () => {
expect(style.innerHTML).toMatch(expected?.backgroundColor || /./);
// Check page-break-inside is set to avoid
expect(style.innerHTML).toMatch(
file !== "valid_no_style_type_html.html"
file !== "html_valid_no_style_type.html"
? /page-break-inside:avoid/
: /./
);
Expand All @@ -135,7 +135,7 @@ describe("Tidy-CSS plugin", () => {
method: "POST",
url: "/",
body: await fs.readFile(
"./test_resources/test_files/valid_empty_html.html"
"./test_resources/test_files/html_valid_empty.html"
),
headers: {
"content-type": "text/html",
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/tidy-html/plugin.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ describe("Tidy-HTML plugin", () => {
method: "POST",
url: "/",
body: await fs.readFile(
"./test_resources/test_files/valid_bullet_issues_html.html"
"./test_resources/test_files/html_valid_bullet_issues.html"
),
headers: {
"content-type": "text/html",
Expand Down Expand Up @@ -103,7 +103,7 @@ describe("Tidy-HTML plugin", () => {
method: "POST",
url: "/",
body: await fs.readFile(
"./test_resources/test_files/valid_bullet_issues_html.html"
"./test_resources/test_files/html_valid_bullet_issues.html"
),
headers: {
"content-type": "text/html",
Expand Down
10 changes: 5 additions & 5 deletions src/routes/doc/txt/route.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ describe("DOC-to-TXT route", () => {
method: "POST",
url: "/",
body: await fs.readFile(
"./test_resources/test_files/valid_doc.doc"
"./test_resources/test_files/doc_valid.doc"
),
headers: {
accept: "application/json, text/plain",
Expand Down Expand Up @@ -72,11 +72,11 @@ describe("DOC-to-TXT route", () => {
it.each([
{
testName: "with '.doc' extension is not a valid DOC file",
filePath: "./test_resources/test_files/invalid_doc.doc",
filePath: "./test_resources/test_files/doc_invalid.doc",
},
{
testName: "is a valid CFBF file but is not a Microsoft Word file",
filePath: "./test_resources/test_files/valid_xls.xls",
filePath: "./test_resources/test_files/xls_valid.xls",
},
])(
"Returns HTTP status code 415 if file $testName",
Expand Down Expand Up @@ -109,7 +109,7 @@ describe("DOC-to-TXT route", () => {
method: "POST",
url: "/",
body: await fs.readFile(
"./test_resources/test_files/valid_empty_html.html"
"./test_resources/test_files/html_valid_empty.html"
),
headers: {
accept: "application/json, text/plain",
Expand All @@ -130,7 +130,7 @@ describe("DOC-to-TXT route", () => {
method: "POST",
url: "/",
body: await fs.readFile(
"./test_resources/test_files/valid_doc.doc"
"./test_resources/test_files/doc_valid.doc"
),
headers: {
accept: "application/javascript",
Expand Down
8 changes: 4 additions & 4 deletions src/routes/docx/html/route.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ describe("DOCX-to-HTML route", () => {
method: "POST",
url: "/",
body: await fs.readFile(
"./test_resources/test_files/valid_docx.docx"
"./test_resources/test_files/docx_valid.docx"
),
query: {
removeAlt: true,
Expand Down Expand Up @@ -84,7 +84,7 @@ describe("DOCX-to-HTML route", () => {
method: "POST",
url: "/",
body: await fs.readFile(
"./test_resources/test_files/invalid_docx.docx"
"./test_resources/test_files/docx_invalid.docx"
),
query: {
lastPageToConvert: 1,
Expand All @@ -109,7 +109,7 @@ describe("DOCX-to-HTML route", () => {
method: "POST",
url: "/",
body: await fs.readFile(
"./test_resources/test_files/valid_empty_html.html"
"./test_resources/test_files/html_valid_empty.html"
),
headers: {
accept: "application/json, text/html",
Expand All @@ -130,7 +130,7 @@ describe("DOCX-to-HTML route", () => {
method: "POST",
url: "/",
body: await fs.readFile(
"./test_resources/test_files/valid_docx.docx"
"./test_resources/test_files/docx_valid.docx"
),
headers: {
accept: "application/javascript",
Expand Down
8 changes: 4 additions & 4 deletions src/routes/docx/txt/route.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ describe("DOCX-to-TXT route", () => {
method: "POST",
url: "/",
body: await fs.readFile(
"./test_resources/test_files/valid_docx.docx"
"./test_resources/test_files/docx_valid.docx"
),
headers: {
accept: "application/json, text/plain",
Expand Down Expand Up @@ -76,7 +76,7 @@ describe("DOCX-to-TXT route", () => {
method: "POST",
url: "/",
body: await fs.readFile(
"./test_resources/test_files/invalid_docx.docx"
"./test_resources/test_files/docx_invalid.docx"
),
query: {
lastPageToConvert: 1,
Expand All @@ -101,7 +101,7 @@ describe("DOCX-to-TXT route", () => {
method: "POST",
url: "/",
body: await fs.readFile(
"./test_resources/test_files/valid_empty_html.html"
"./test_resources/test_files/html_valid_empty.html"
),
headers: {
accept: "application/json, text/plain",
Expand All @@ -122,7 +122,7 @@ describe("DOCX-to-TXT route", () => {
method: "POST",
url: "/",
body: await fs.readFile(
"./test_resources/test_files/valid_docx.docx"
"./test_resources/test_files/docx_valid.docx"
),
headers: {
accept: "application/javascript",
Expand Down
8 changes: 4 additions & 4 deletions src/routes/html/txt/route.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ describe("HTML-to-TXT route", () => {
method: "POST",
url: "/",
body: await fs.readFile(
"./test_resources/test_files/valid_html.html"
"./test_resources/test_files/html_valid.html"
),
headers: {
accept: "application/json, text/plain",
Expand Down Expand Up @@ -74,7 +74,7 @@ describe("HTML-to-TXT route", () => {
method: "POST",
url: "/",
body: await fs.readFile(
"./test_resources/test_files/invalid_html.html"
"./test_resources/test_files/html_invalid.html"
),
query: {
lastPageToConvert: 1,
Expand All @@ -98,7 +98,7 @@ describe("HTML-to-TXT route", () => {
method: "POST",
url: "/",
body: await fs.readFile(
"./test_resources/test_files/valid_empty_html.html"
"./test_resources/test_files/html_valid_empty.html"
),
headers: {
accept: "application/json, text/plain",
Expand All @@ -119,7 +119,7 @@ describe("HTML-to-TXT route", () => {
method: "POST",
url: "/",
body: await fs.readFile(
"./test_resources/test_files/valid_html.html"
"./test_resources/test_files/html_valid.html"
),
headers: {
accept: "application/javascript",
Expand Down

0 comments on commit c5cc479

Please sign in to comment.