Skip to content

Commit 070417c

Browse files
committed
feat tests: make sure that emojii are treated well
Tests: протестировано локально и в CI, на прод не влияет commit_hash:5000f621a4e52f350bee6795356e05143df3d2db
1 parent c320a9b commit 070417c

6 files changed

Lines changed: 28 additions & 4 deletions

File tree

samples/static_service/public/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<html lang="en">
33
<head>
44
<meta charset="utf-8">
5-
<title>userver sample</title>
5+
<title>🐙 userver sample</title>
66
<link href="custom.css" rel="stylesheet">
77
<script type="text/javascript" src="custom.js"></script>
88
</head>

samples/static_service/static_config.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,23 @@ components_manager:
3838
path: /* # Registering handlers '/*' find files.
3939
method: GET # Handle only GET requests.
4040
# /// [static config]
41+
42+
dynamic-config: # Dynamic config storage options
43+
defaults:
44+
USERVER_FILES_CONTENT_TYPE_MAP:
45+
.css: "text/css"
46+
.gif: "image/gif"
47+
.htm: "text/html; charset=utf-8"
48+
.html: "text/html; charset=utf-8"
49+
.jpeg: "image/jpeg"
50+
.js: "application/javascript"
51+
.json: "application/json"
52+
.md: "text/markdown"
53+
.png: "image/png"
54+
.svg: "image/svg+xml"
55+
.ttf: "font/ttf"
56+
.otf: "font/otf"
57+
.woff: "font/woff"
58+
.woff2: "font/woff2"
59+
.eot: "application/vnd.ms-fontobject"
60+

samples/static_service/testsuite/test_static.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
async def test_file(service_client, service_source_dir, path):
77
response = await service_client.get(path)
88
assert response.status == 200
9-
assert response.headers['Content-Type'] == 'text/html'
9+
assert response.headers['Content-Type'] == 'text/html; charset=utf-8'
1010
assert response.headers['Expires'] == '600'
1111
file = service_source_dir.joinpath('public') / 'index.html'
1212
assert response.content.decode() == file.open().read()

scripts/docs/scripts/styledBtn.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export function styleNavButtons() {
55
if (!(navButtonsContainer && navButtons.length)) return;
66

77
for (const button of navButtons) {
8-
const isBackButton = button.previousSibling.textContent.includes('⇦') || button.previousSibling.textContent.includes('⇦');
8+
const isBackButton = button.previousSibling.textContent.includes('⇦');
99
button.className = `button ${isBackButton ? 'prev' : 'next'}`;
1010
button.innerHTML = `<span class="btn-sub">${isBackButton ? 'Go back' : 'Up next'}</span><span class="btn-title">${button.innerHTML}</span>`;
1111
}

universal/src/fs/blocking/c_file_test.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,11 @@ TEST(CFile, Writing) {
6969

7070
fs::blocking::CFile file(path, {fs::blocking::OpenFlag::kWrite, fs::blocking::OpenFlag::kCreateIfNotExists});
7171
file.Write("bar");
72+
file.Write("<p>🐙 <b>userver</b></p>");
7273
file.Write("baz");
7374
file.Flush();
7475

75-
EXPECT_EQ(fs::blocking::ReadFileContents(path), "barbaz");
76+
EXPECT_EQ(fs::blocking::ReadFileContents(path), "bar<p>🐙 <b>userver</b></p>baz");
7677
}
7778

7879
TEST(CFile, WriteEmpty) {

universal/src/fs/blocking/file_descriptor_test.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@ TEST(FileDescriptor, WriteNonTruncating) {
8787
fd.Seek(1);
8888
fd.Write("dd");
8989
EXPECT_EQ(fs::blocking::ReadFileContents(path), "bddc");
90+
91+
fd.Write("<p>🐙 <b>userver</b></p>");
92+
EXPECT_EQ(fs::blocking::ReadFileContents(path), "bdd<p>🐙 <b>userver</b></p>");
9093
}
9194

9295
TEST(FileDescriptor, WriteTruncating) {

0 commit comments

Comments
 (0)