Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
MIME Normalizer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Code
JS Toolbox
MIME Normalizer
Commits
f3eee30f
Commit
f3eee30f
authored
4 years ago
by
Igor Markin
Browse files
Options
Downloads
Patches
Plain Diff
Add comments
parent
b29df335
No related branches found
No related tags found
1 merge request
!3
Fix normalisation cases
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
__tests__/html-outlook-outlook.test.ts
+17
-4
17 additions, 4 deletions
__tests__/html-outlook-outlook.test.ts
__tests__/utils.ts
+28
-23
28 additions, 23 deletions
__tests__/utils.ts
with
45 additions
and
27 deletions
__tests__/html-outlook-outlook.test.ts
+
17
−
4
View file @
f3eee30f
...
@@ -12,13 +12,26 @@ describe("Outlook emails HTML normalization", () => {
...
@@ -12,13 +12,26 @@ describe("Outlook emails HTML normalization", () => {
EMAIL_VENDORS
.
OUTLOOK
EMAIL_VENDORS
.
OUTLOOK
);
);
describe
(
"
Emails Chrome
"
,
describeFunction
(
"
chrome
"
));
// describe("Emails Chrome", describeFunction("chrome"));
describe
(
"
Emails Edge
"
,
describeFunction
(
"
edge
"
,
[
"
21
"
]));
describe
(
describe
(
"
Emails Safari
"
,
describeFunction
(
"
safari
"
,
[
"
04
"
]));
"
Emails Edge
"
,
describeFunction
(
"
edge
"
,
[
"
21
"
,
// This case has a src mismatch for the same image. Reproduce this case again
])
);
describe
(
"
Emails Safari
"
,
describeFunction
(
"
safari
"
,
[
"
04
"
,
// This case contains <section> tag which is ignored by Outlook, and it also inserts a plenty of empty divs
])
);
// Does not work at all
// describe(
// describe(
// "Emails MacOS",
// "Emails MacOS",
// describeFunction("macos", ["20", "21", "
22
", "23", "24", "25", "26"])
// describeFunction("macos", ["20", "21", "", "23", "24", "25", "26"])
// );
// );
describe
(
describe
(
"
Emails Windows
"
,
"
Emails Windows
"
,
describeFunction
(
"
windows
"
,
[
describeFunction
(
"
windows
"
,
[
...
...
This diff is collapsed.
Click to expand it.
__tests__/utils.ts
+
28
−
23
View file @
f3eee30f
...
@@ -71,29 +71,34 @@ export const getNormalizedHtml = (
...
@@ -71,29 +71,34 @@ export const getNormalizedHtml = (
export
const
createDescribeHtmlTestCases
=
(
export
const
createDescribeHtmlTestCases
=
(
testsPath
:
string
,
testsPath
:
string
,
vendor
:
string
vendor
:
string
)
=>
(
casesGroupName
:
string
,
failingCases
:
Array
<
string
>
=
[])
=>
():
void
=>
{
)
=>
const
testsCasesPath
=
testsPath
+
"
/
"
+
casesGroupName
;
/**
const
testCasesDirs
=
getTestCasesDirs
(
testsCasesPath
).
filter
(
* @param casesGroupName - name of the folder with cases
(
dir
)
=>
!
failingCases
.
includes
(
dir
)
* @param failingCases - a list of cases that are failing and ignored. Pending to be fixed
);
*/
(
casesGroupName
:
string
,
failingCases
:
Array
<
string
>
=
[])
=>
():
void
=>
{
test
.
each
(
testCasesDirs
)(
"
Case %s
"
,
(
dirName
:
string
)
=>
{
const
testsCasesPath
=
testsPath
+
"
/
"
+
casesGroupName
;
const
testCasePath
=
testsCasesPath
+
"
/
"
+
dirName
;
const
testCasesDirs
=
getTestCasesDirs
(
testsCasesPath
).
filter
(
let
normalizedHtmls
;
(
dir
)
=>
!
failingCases
.
includes
(
dir
)
try
{
);
normalizedHtmls
=
getNormalizedHtml
(
testCasePath
,
vendor
);
}
catch
(
e
)
{
test
.
each
(
testCasesDirs
)(
"
Case %s
"
,
(
dirName
:
string
)
=>
{
console
.
log
(
`Invalid test case:
${
casesGroupName
}
/
${
dirName
}
`
);
const
testCasePath
=
testsCasesPath
+
"
/
"
+
dirName
;
return
;
let
normalizedHtmls
;
}
try
{
normalizedHtmls
=
getNormalizedHtml
(
testCasePath
,
vendor
);
const
{
sentHtml
,
receivedHtml
}
=
normalizedHtmls
;
}
catch
(
e
)
{
console
.
log
(
`Invalid test case:
${
casesGroupName
}
/
${
dirName
}
`
);
expect
(
receivedHtml
.
length
).
toBeGreaterThan
(
0
);
return
;
expect
(
sentHtml
.
length
).
toBeGreaterThan
(
0
);
}
expect
(
receivedHtml
).
toContain
(
sentHtml
);
});
const
{
sentHtml
,
receivedHtml
}
=
normalizedHtmls
;
};
expect
(
receivedHtml
.
length
).
toBeGreaterThan
(
0
);
expect
(
sentHtml
.
length
).
toBeGreaterThan
(
0
);
expect
(
receivedHtml
).
toContain
(
sentHtml
);
});
};
export
const
createDescribePlainTestCases
=
(
testsPath
:
string
)
=>
(
export
const
createDescribePlainTestCases
=
(
testsPath
:
string
)
=>
(
casesName
:
string
,
casesName
:
string
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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