Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
Frontend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Package Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Contributor analytics
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
HUB Terra
SMS
Frontend
Commits
ce8bbc75
Commit
ce8bbc75
authored
4 years ago
by
Nils Brinckmann
Browse files
Options
Downloads
Patches
Plain Diff
Project model
parent
a1ba66b1
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!57
WIP: Feature oidc gfz integrated work
,
!53
Feature basic configuration api
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
models/Project.ts
+90
-0
90 additions, 0 deletions
models/Project.ts
test/models/Project.test.ts
+103
-0
103 additions, 0 deletions
test/models/Project.test.ts
with
193 additions
and
0 deletions
models/Project.ts
0 → 100644
+
90
−
0
View file @
ce8bbc75
/**
* @license
* Web client of the Sensor Management System software developed within
* the Helmholtz DataHub Initiative by GFZ and UFZ.
*
* Copyright (C) 2020
* - Nils Brinckmann (GFZ, nils.brinckmann@gfz-potsdam.de)
* - Marc Hanisch (GFZ, marc.hanisch@gfz-potsdam.de)
* - Helmholtz Centre Potsdam - GFZ German Research Centre for
* Geosciences (GFZ, https://www.gfz-potsdam.de)
*
* Parts of this program were developed within the context of the
* following publicly funded projects or measures:
* - Helmholtz Earth and Environment DataHub
* (https://www.helmholtz.de/en/research/earth_and_environment/initiatives/#h51095)
*
* Licensed under the HEESIL, Version 1.0 or - as soon they will be
* approved by the "Community" - subsequent versions of the HEESIL
* (the "Licence").
*
* You may not use this work except in compliance with the Licence.
*
* You may obtain a copy of the Licence at:
* https://gitext.gfz-potsdam.de/software/heesil
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the Licence is distributed on an "AS IS" basis,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied. See the Licence for the specific language governing
* permissions and limitations under the Licence.
*/
export
interface
IProject
{
id
:
string
name
:
string
uri
:
string
}
export
class
Project
implements
IProject
{
private
_id
:
string
=
''
private
_name
:
string
=
''
private
_uri
:
string
=
''
get
id
():
string
{
return
this
.
_id
}
set
id
(
newId
:
string
)
{
this
.
_id
=
newId
}
get
name
():
string
{
return
this
.
_name
}
set
name
(
newName
:
string
)
{
this
.
_name
=
newName
}
get
uri
():
string
{
return
this
.
_uri
}
set
uri
(
newUri
:
string
)
{
this
.
_uri
=
newUri
}
toString
():
string
{
return
this
.
_name
}
static
createWithData
(
id
:
string
,
name
:
string
,
uri
:
string
):
Project
{
const
result
=
new
Project
()
result
.
id
=
id
result
.
name
=
name
result
.
uri
=
uri
return
result
}
static
createFromObject
(
someObject
:
IProject
):
Project
{
const
newObject
=
new
Project
()
newObject
.
id
=
someObject
.
id
newObject
.
name
=
someObject
.
name
newObject
.
uri
=
someObject
.
uri
return
newObject
}
}
This diff is collapsed.
Click to expand it.
test/models/Project.test.ts
0 → 100644
+
103
−
0
View file @
ce8bbc75
/**
* @license
* Web client of the Sensor Management System software developed within
* the Helmholtz DataHub Initiative by GFZ and UFZ.
*
* Copyright (C) 2020
* - Nils Brinckmann (GFZ, nils.brinckmann@gfz-potsdam.de)
* - Marc Hanisch (GFZ, marc.hanisch@gfz-potsdam.de)
* - Helmholtz Centre Potsdam - GFZ German Research Centre for
* Geosciences (GFZ, https://www.gfz-potsdam.de)
*
* Parts of this program were developed within the context of the
* following publicly funded projects or measures:
* - Helmholtz Earth and Environment DataHub
* (https://www.helmholtz.de/en/research/earth_and_environment/initiatives/#h51095)
*
* Licensed under the HEESIL, Version 1.0 or - as soon they will be
* approved by the "Community" - subsequent versions of the HEESIL
* (the "Licence").
*
* You may not use this work except in compliance with the Licence.
*
* You may obtain a copy of the Licence at:
* https://gitext.gfz-potsdam.de/software/heesil
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the Licence is distributed on an "AS IS" basis,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied. See the Licence for the specific language governing
* permissions and limitations under the Licence.
*/
import
{
Project
}
from
'
@/models/Project
'
describe
(
'
Project
'
,
()
=>
{
describe
(
'
#id
'
,
()
=>
{
it
(
'
should be an empty string for a new object
'
,
()
=>
{
const
emptyProject
=
new
Project
()
expect
(
emptyProject
.
id
).
toEqual
(
''
)
})
it
(
'
should be possible to set it
'
,
()
=>
{
const
project
=
new
Project
()
project
.
id
=
'
newid
'
expect
(
project
.
id
).
toEqual
(
'
newid
'
)
})
})
describe
(
'
#name
'
,
()
=>
{
it
(
'
should be an empty string for a new object
'
,
()
=>
{
const
emptyProject
=
new
Project
()
expect
(
emptyProject
.
name
).
toEqual
(
''
)
})
it
(
'
should be possible to set it
'
,
()
=>
{
const
project
=
new
Project
()
project
.
name
=
'
new name
'
expect
(
project
.
name
).
toEqual
(
'
new name
'
)
})
})
describe
(
'
#uri
'
,
()
=>
{
it
(
'
should be an empty string for a new object
'
,
()
=>
{
const
emptyProject
=
new
Project
()
expect
(
emptyProject
.
uri
).
toEqual
(
''
)
})
it
(
'
should be possible t oset it
'
,
()
=>
{
const
project
=
new
Project
()
project
.
uri
=
'
newuri
'
expect
(
project
.
uri
).
toEqual
(
'
newuri
'
)
})
})
describe
(
'
#toString
'
,
()
=>
{
it
(
'
should be equal to the name
'
,
()
=>
{
const
namesToSet
=
[
'
abc
'
,
'
cde
'
]
for
(
const
name
of
namesToSet
)
{
const
project
=
new
Project
()
project
.
name
=
name
expect
(
project
.
toString
()).
toEqual
(
name
)
}
})
})
describe
(
'
#createWithData
'
,
()
=>
{
it
(
'
should be possible to create the object right away with some data
'
,
()
=>
{
const
project
=
Project
.
createWithData
(
'
someId
'
,
'
some name
'
,
'
someuri
'
)
expect
(
project
.
id
).
toEqual
(
'
someId
'
)
expect
(
project
.
name
).
toEqual
(
'
some name
'
)
expect
(
project
.
uri
).
toEqual
(
'
someuri
'
)
})
})
describe
(
'
#createFromObject
'
,
()
=>
{
it
(
'
should be possible to create from an object
'
,
()
=>
{
const
project
=
Project
.
createFromObject
({
id
:
'
someId
'
,
name
:
'
some name
'
,
uri
:
'
someuri
'
})
expect
(
project
.
id
).
toEqual
(
'
someId
'
)
expect
(
project
.
name
).
toEqual
(
'
some name
'
)
expect
(
project
.
uri
).
toEqual
(
'
someuri
'
)
})
})
})
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