IEEE.org
|
IEEE Xplore Digital Library
|
IEEE Standards
|
IEEE Spectrum
|
More Sites
Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Open at RIT
My Conservation Life
Conservation360
Commits
393d962e
Commit
393d962e
authored
Feb 10, 2020
by
APalumbo97
Browse files
Merge branch 'dev' into export-headers
parents
27f8ffb1
7f0de63a
Changes
6
Hide whitespace changes
Inline
Side-by-side
db/api/tests/endpoints/assetDefinition.test.js
View file @
393d962e
...
...
@@ -85,14 +85,14 @@ describe('GET assetTypes', () => {
.
get
(
'
/api/v1/assetTypes
'
)
.
expect
(
200
)
.
then
((
res
)
=>
{
expect
(
res
.
body
).
toEqual
(
expect
(
res
.
body
.
rows
).
toEqual
(
expect
.
arrayContaining
([
expect
.
objectContaining
(
EXPECTED_ASSET_TYPE1
),
expect
.
objectContaining
(
EXPECTED_ASSET_TYPE2
),
expect
.
objectContaining
(
EXPECTED_ASSET_TYPE3
)
])
);
expect
(
res
.
body
).
toHaveLength
(
3
);
expect
(
res
.
body
.
rows
).
toHaveLength
(
3
);
});
});
});
...
...
db/api/v1/controllers/__tests__/assetDefinitions.controller.test.js
View file @
393d962e
const
{
find
AssetTypes
}
=
require
(
'
../assetDefinitions.controller
'
);
const
{
get
AssetTypes
}
=
require
(
'
../assetDefinitions.controller
'
);
const
assetDefinitionsDb
=
require
(
'
../../db/assetDefinitions.db
'
);
describe
(
'
assetDefinitions.controller.getAssetTypes
'
,
()
=>
{
...
...
@@ -22,8 +22,8 @@ describe('assetDefinitions.controller.getAssetTypes', () => {
});
it
(
'
returns all asset types in DB
'
,
async
()
=>
{
await
find
AssetTypes
(
req
,
res
,
next
);
expect
(
res
.
json
).
toHaveBeenCalledWith
(
expectedAssetTypes
);
await
get
AssetTypes
(
req
,
res
,
next
);
expect
(
res
.
json
).
toHaveBeenCalledWith
(
data
);
});
});
...
...
db/api/v1/db/assets.db.js
View file @
393d962e
...
...
@@ -14,7 +14,10 @@ FROM
JOIN project ON asset.project_id = project.id
JOIN sponsor ON project.sponsor_id = sponsor.id
JOIN asset_type ON asset.asset_type_id = asset_type.id
`
;
WHERE
TRUE
`
;
// The WHERE TRUE is needed for the find function to append WHERE clauses properly
/**
* Find project assets.
...
...
@@ -142,4 +145,3 @@ module.exports = {
find
,
create
};
db/api/v1/db/projects.db.js
View file @
393d962e
...
...
@@ -16,7 +16,7 @@ const QUERY_FIND = `
project
WHERE
TRUE
`
;
`
;
// The WHERE TRUE is needed for the find function to append WHERE clauses properly
// A query to create a new project in the database
const
QUERY_CREATE
=
`
...
...
salesforce/my-conservation-life/force-app/main/default/lwc/controllers/__tests__/assetDefinitionsController.test.js
View file @
393d962e
...
...
@@ -15,7 +15,7 @@ describe('assetDefinitions.findAssetTypes', () => {
});
it
(
'
finds all asset types stored in the DB
'
,
async
()
=>
{
const
assetTypes
=
await
assetDefinitions
.
f
ind
AssetTypes
();
const
assetTypes
=
await
assetDefinitions
.
f
etch
AssetTypes
();
expect
(
fetch
.
mock
.
calls
[
0
][
0
]).
toBe
(
URL
);
expect
(
assetTypes
).
toEqual
(
EXPECTED_ASSET_TYPES
);
});
...
...
@@ -42,4 +42,4 @@ describe('assetDefinitions.sendCSV', () => {
expect
(
fetch
.
mock
.
calls
[
0
][
0
]).
toBe
(
URL
);
expect
(
response
).
toEqual
(
EXPECTED_RESPONSE
);
});
});
\ No newline at end of file
});
salesforce/my-conservation-life/force-app/main/default/lwc/utils/utils.js
View file @
393d962e
...
...
@@ -27,6 +27,16 @@ const post = (url, data) => {
}).
then
(
handleFetchErrors
);
};
const
put
=
(
url
,
data
)
=>
{
return
fetch
(
url
,
{
method
:
'
PUT
'
,
headers
:
{
'
Content-Type
'
:
'
application/json
'
},
body
:
JSON
.
stringify
(
data
)
}).
then
(
handleFetchErrors
);
};
const
putCSV
=
(
url
,
assetTypeId
,
csvFile
)
=>
{
// Key-value pairs that represent form fields and corresponding values
const
formData
=
new
FormData
();
...
...
@@ -43,5 +53,6 @@ export default {
URL
,
get
,
post
,
put
,
putCSV
};
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment