Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
U
ui-middleware
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Open Source Software
OX App Suite
Core
ui-middleware
Commits
7216f972
Commit
7216f972
authored
2 years ago
by
richard.petersen
Browse files
Options
Downloads
Patches
Plain Diff
Repair tests
parent
867770f7
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
integration/caching_test.js
+5
-3
5 additions, 3 deletions
integration/caching_test.js
spec/file_caching_test.js
+2
-2
2 additions, 2 deletions
spec/file_caching_test.js
spec/server_test.js
+4
-15
4 additions, 15 deletions
spec/server_test.js
with
11 additions
and
20 deletions
integration/caching_test.js
+
5
−
3
View file @
7216f972
import
request
from
'
supertest
'
import
{
expect
}
from
'
chai
'
import
{
generateSimpleViteManifest
,
mockApp
,
mockConfig
,
mockFetch
}
from
'
../spec/util.js
'
import
{
brotliParser
,
generateSimpleViteManifest
,
mockApp
,
mockConfig
,
mockFetch
}
from
'
../spec/util.js
'
import
*
as
td
from
'
testdouble
'
import
{
getRedisKey
}
from
'
../src/util.js
'
import
zlib
from
'
node:zlib
'
describe
(
'
File caching service
'
,
function
()
{
let
app
...
...
@@ -26,13 +27,14 @@ describe('File caching service', function () {
})
it
(
'
caches manifest data
'
,
async
function
()
{
const
response
=
await
request
(
app
.
server
).
get
(
'
/manifests
'
)
const
response
=
await
request
(
app
.
server
).
get
(
'
/manifests
'
)
.
parse
(
brotliParser
)
expect
(
response
.
statusCode
).
to
.
equal
(
200
)
const
version
=
response
.
headers
.
version
const
{
client
}
=
await
import
(
'
../src/redis.js
'
)
expect
(
await
client
.
get
(
getRedisKey
({
version
,
name
:
'
viteManifests
'
}))).
to
.
equal
(
'
{"index.html":{"file":"index.html","meta":{"baseUrl":"http://ui-server/"}}}
'
)
expect
(
await
client
.
get
(
getRedisKey
({
version
,
name
:
'
oxManifests
'
}))).
to
.
equal
(
'
[]
'
)
const
redisData
=
await
client
.
getBuffer
(
getRedisKey
({
version
,
name
:
'
oxManifests:body
'
}))
expect
(
zlib
.
brotliDecompressSync
(
redisData
||
''
).
toString
()).
to
.
equal
(
'
[]
'
)
})
it
(
'
caches html files
'
,
async
function
()
{
...
...
This diff is collapsed.
Click to expand it.
spec/file_caching_test.js
+
2
−
2
View file @
7216f972
import
request
from
'
supertest
'
import
{
generateSimpleViteManifest
,
mockApp
,
mockConfig
,
mockFetch
,
mockRedis
}
from
'
./util.js
'
import
{
brotliParser
,
generateSimpleViteManifest
,
mockApp
,
mockConfig
,
mockFetch
,
mockRedis
}
from
'
./util.js
'
import
fs
from
'
fs
'
import
{
expect
}
from
'
chai
'
import
*
as
td
from
'
testdouble
'
...
...
@@ -350,7 +350,7 @@ describe('File caching service', function () {
expect
(
spy
.
callCount
).
to
.
equal
(
0
)
const
[
res1
,
res2
]
=
await
Promise
.
all
([
request
(
app
.
server
).
get
(
'
/manifests
'
),
request
(
app
.
server
).
get
(
'
/manifests
'
)
.
parse
(
brotliParser
)
,
request
(
app
.
server
).
get
(
'
/example.js
'
)
])
expect
(
res1
.
statusCode
).
to
.
equal
(
200
)
...
...
This diff is collapsed.
Click to expand it.
spec/server_test.js
+
4
−
15
View file @
7216f972
...
...
@@ -27,21 +27,9 @@ describe('UI Middleware', function () {
})
it
(
'
fetches manifest data
'
,
async
function
()
{
const
response
=
await
request
(
app
.
server
).
get
(
'
/manifests
'
)
expect
(
response
.
statusCode
).
to
.
equal
(
200
)
expect
(
response
.
headers
[
'
content-encoding
'
]).
to
.
equal
(
'
gzip
'
)
expect
(
response
.
body
).
to
.
deep
.
equal
([{
namespace
:
'
test
'
,
path
:
'
example
'
}])
})
it
(
'
fetches manifest data with brotli
'
,
async
function
()
{
const
response
=
await
request
(
app
.
server
)
.
get
(
'
/manifests
'
)
.
set
(
'
accept-encoding
'
,
'
deflate, gzip, br
'
)
.
buffer
(
true
)
.
parse
(
brotliParser
)
const
response
=
await
request
(
app
.
server
).
get
(
'
/manifests
'
).
parse
(
brotliParser
)
expect
(
response
.
statusCode
).
to
.
equal
(
200
)
expect
(
response
.
headers
[
'
content-encoding
'
]).
to
.
equal
(
'
br
'
)
expect
(
response
.
headers
[
'
content-type
'
]).
to
.
equal
(
'
application/json; charset=utf-8
'
)
expect
(
response
.
body
).
to
.
deep
.
equal
([{
namespace
:
'
test
'
,
path
:
'
example
'
}])
})
...
...
@@ -56,7 +44,7 @@ describe('UI Middleware', function () {
})
it
(
'
caches manifest data
'
,
async
function
()
{
const
response
=
await
request
(
app
.
server
).
get
(
'
/manifests
'
)
const
response
=
await
request
(
app
.
server
).
get
(
'
/manifests
'
)
.
parse
(
brotliParser
)
expect
(
response
.
statusCode
).
to
.
equal
(
200
)
expect
(
response
.
body
).
to
.
deep
.
equal
([{
namespace
:
'
test
'
,
path
:
'
example
'
}])
...
...
@@ -67,7 +55,7 @@ describe('UI Middleware', function () {
await
new
Promise
(
resolve
=>
setTimeout
(
resolve
,
150
))
const
response2
=
await
request
(
app
.
server
).
get
(
'
/manifests
'
)
const
response2
=
await
request
(
app
.
server
).
get
(
'
/manifests
'
)
.
parse
(
brotliParser
)
expect
(
response2
.
statusCode
).
to
.
equal
(
200
)
expect
(
response2
.
body
).
to
.
deep
.
equal
([{
namespace
:
'
test
'
,
path
:
'
example
'
}])
})
...
...
@@ -93,6 +81,7 @@ describe('UI Middleware', function () {
it
(
'
can load multiple configurations
'
,
async
function
()
{
await
request
(
app
.
server
)
.
get
(
'
/manifests
'
)
.
parse
(
brotliParser
)
.
then
(
response
=>
{
expect
(
response
.
statusCode
).
to
.
equal
(
200
)
expect
(
response
.
body
).
to
.
deep
.
equal
([
...
...
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