Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
frontend-clients
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
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
OZG-Cloud
app
frontend-clients
Commits
10b8c2d2
Commit
10b8c2d2
authored
2 years ago
by
OZGCloud
Browse files
Options
Downloads
Patches
Plain Diff
OZG-3574 Handle empty error (2)
parent
30de7e11
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
goofy-client/libs/vorgang-shared/src/lib/vorgang.service.spec.ts
+29
-1
29 additions, 1 deletion
...lient/libs/vorgang-shared/src/lib/vorgang.service.spec.ts
goofy-client/libs/vorgang-shared/src/lib/vorgang.service.ts
+2
-2
2 additions, 2 deletions
goofy-client/libs/vorgang-shared/src/lib/vorgang.service.ts
with
31 additions
and
3 deletions
goofy-client/libs/vorgang-shared/src/lib/vorgang.service.spec.ts
+
29
−
1
View file @
10b8c2d2
...
@@ -21,6 +21,7 @@
...
@@ -21,6 +21,7 @@
* Die sprachspezifischen Genehmigungen und Beschränkungen
* Die sprachspezifischen Genehmigungen und Beschränkungen
* unter der Lizenz sind dem Lizenztext zu entnehmen.
* unter der Lizenz sind dem Lizenztext zu entnehmen.
*/
*/
import
{
HttpErrorResponse
}
from
'
@angular/common/http
'
;
import
{
faker
}
from
'
@faker-js/faker
'
;
import
{
faker
}
from
'
@faker-js/faker
'
;
import
{
ApiRootService
}
from
'
@goofy-client/api-root-shared
'
;
import
{
ApiRootService
}
from
'
@goofy-client/api-root-shared
'
;
import
{
CommandListResource
,
CommandResource
,
CommandService
}
from
'
@goofy-client/command-shared
'
;
import
{
CommandListResource
,
CommandResource
,
CommandService
}
from
'
@goofy-client/command-shared
'
;
...
@@ -32,8 +33,9 @@ import { cold } from 'jest-marbles';
...
@@ -32,8 +33,9 @@ import { cold } from 'jest-marbles';
import
{
createBinaryFileListResource
}
from
'
libs/binary-file-shared/test/binary-file
'
;
import
{
createBinaryFileListResource
}
from
'
libs/binary-file-shared/test/binary-file
'
;
import
{
CommandLinkRel
}
from
'
libs/command-shared/src/lib/command.linkrel
'
;
import
{
CommandLinkRel
}
from
'
libs/command-shared/src/lib/command.linkrel
'
;
import
{
createCommandListResource
,
createCommandResource
}
from
'
libs/command-shared/test/command
'
;
import
{
createCommandListResource
,
createCommandResource
}
from
'
libs/command-shared/test/command
'
;
import
{
createHttpErrorResponse
}
from
'
libs/tech-shared/test/error
'
;
import
{
createVorgangWithEingangResource
}
from
'
libs/vorgang-shared/test/vorgang
'
;
import
{
createVorgangWithEingangResource
}
from
'
libs/vorgang-shared/test/vorgang
'
;
import
{
of
}
from
'
rxjs
'
;
import
{
EMPTY
,
EmptyError
,
Observable
,
of
,
throwError
}
from
'
rxjs
'
;
import
{
VorgangFacade
}
from
'
./+state/vorgang.facade
'
;
import
{
VorgangFacade
}
from
'
./+state/vorgang.facade
'
;
import
{
VorgangRepository
}
from
'
./+state/vorgang.repository
'
;
import
{
VorgangRepository
}
from
'
./+state/vorgang.repository
'
;
import
{
VorgangWithEingangLinkRel
}
from
'
./vorgang.linkrel
'
;
import
{
VorgangWithEingangLinkRel
}
from
'
./vorgang.linkrel
'
;
...
@@ -109,6 +111,16 @@ describe('VorgangService', () => {
...
@@ -109,6 +111,16 @@ describe('VorgangService', () => {
expect
(
repository
.
getVorgang
).
toHaveBeenCalledWith
(
url
);
expect
(
repository
.
getVorgang
).
toHaveBeenCalledWith
(
url
);
})
})
it
(
'
should call handleError
'
,
()
=>
{
const
errorResponse
:
HttpErrorResponse
=
createHttpErrorResponse
();
repository
.
getVorgang
.
mockReturnValue
(
throwError
(()
=>
new
Error
(
errorResponse
.
error
)));
service
.
handleError
=
jest
.
fn
();
service
.
loadVorgangWithEingang
(
url
);
expect
(
service
.
handleError
).
toHaveBeenCalled
();
})
it
(
'
should update vorgang
'
,
()
=>
{
it
(
'
should update vorgang
'
,
()
=>
{
service
.
updateVorgang
=
jest
.
fn
();
service
.
updateVorgang
=
jest
.
fn
();
const
vorgangWithEingang
:
VorgangWithEingangResource
=
createVorgangWithEingangResource
();
const
vorgangWithEingang
:
VorgangWithEingangResource
=
createVorgangWithEingangResource
();
...
@@ -120,6 +132,22 @@ describe('VorgangService', () => {
...
@@ -120,6 +132,22 @@ describe('VorgangService', () => {
})
})
})
})
describe
(
'
handleError
'
,
()
=>
{
it
(
'
should call setVorgangWithEingang
'
,
()
=>
{
service
.
setVorgangWithEingang
=
jest
.
fn
();
service
.
handleError
();
expect
(
service
.
setVorgangWithEingang
).
toHaveBeenCalled
();
})
it
(
'
should return EMPTY
'
,
()
=>
{
const
result
:
Observable
<
EmptyError
>
=
service
.
handleError
();
expect
(
result
).
toBe
(
EMPTY
);
})
})
describe
(
'
updateVorgang
'
,
()
=>
{
describe
(
'
updateVorgang
'
,
()
=>
{
beforeEach
(()
=>
{
beforeEach
(()
=>
{
...
...
This diff is collapsed.
Click to expand it.
goofy-client/libs/vorgang-shared/src/lib/vorgang.service.ts
+
2
−
2
View file @
10b8c2d2
...
@@ -31,7 +31,7 @@ import { PostfachOrder } from '@goofy-client/postfach-shared';
...
@@ -31,7 +31,7 @@ import { PostfachOrder } from '@goofy-client/postfach-shared';
import
{
ApiError
,
createEmptyStateResource
,
createErrorStateResource
,
createStateResource
,
doIfLoadingRequired
,
isNotNil
,
isNotNull
,
isNotUndefined
,
StateResource
}
from
'
@goofy-client/tech-shared
'
;
import
{
ApiError
,
createEmptyStateResource
,
createErrorStateResource
,
createStateResource
,
doIfLoadingRequired
,
isNotNil
,
isNotNull
,
isNotUndefined
,
StateResource
}
from
'
@goofy-client/tech-shared
'
;
import
{
getUrl
,
hasLink
,
ResourceUri
}
from
'
@ngxp/rest
'
;
import
{
getUrl
,
hasLink
,
ResourceUri
}
from
'
@ngxp/rest
'
;
import
{
CommandLinkRel
}
from
'
libs/command-shared/src/lib/command.linkrel
'
;
import
{
CommandLinkRel
}
from
'
libs/command-shared/src/lib/command.linkrel
'
;
import
{
BehaviorSubject
,
combineLatest
,
EMPTY
,
Observable
,
Subscription
}
from
'
rxjs
'
;
import
{
BehaviorSubject
,
combineLatest
,
EMPTY
,
EmptyError
,
Observable
,
Subscription
}
from
'
rxjs
'
;
import
{
catchError
,
first
,
map
,
startWith
,
tap
}
from
'
rxjs/operators
'
;
import
{
catchError
,
first
,
map
,
startWith
,
tap
}
from
'
rxjs/operators
'
;
import
{
VorgangFacade
}
from
'
./+state/vorgang.facade
'
;
import
{
VorgangFacade
}
from
'
./+state/vorgang.facade
'
;
import
{
VorgangRepository
}
from
'
./+state/vorgang.repository
'
;
import
{
VorgangRepository
}
from
'
./+state/vorgang.repository
'
;
...
@@ -94,7 +94,7 @@ export class VorgangService {
...
@@ -94,7 +94,7 @@ export class VorgangService {
).
subscribe
((
vorgang
:
VorgangWithEingangResource
)
=>
this
.
updateVorgang
(
vorgang
));
).
subscribe
((
vorgang
:
VorgangWithEingangResource
)
=>
this
.
updateVorgang
(
vorgang
));
}
}
handleError
():
Observable
<
Api
Error
>
{
handleError
():
Observable
<
Empty
Error
>
{
this
.
setVorgangWithEingang
(
createErrorStateResource
(
<
ApiError
>
{}));
this
.
setVorgangWithEingang
(
createErrorStateResource
(
<
ApiError
>
{}));
return
EMPTY
;
return
EMPTY
;
}
}
...
...
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