Skip to content

Commit

Permalink
MMT-3315: As a user I want to see variable instance/zarr store inform…
Browse files Browse the repository at this point in the history
…ation in the variable tab. (#61)

* MMT-3315: Added support for Instance Information.

* MMT-3315: Added the new field for variable tests

* MMT-3315: updated variable version
  • Loading branch information
dmistry1 authored Aug 22, 2023
1 parent 3ce049c commit d89ade4
Show file tree
Hide file tree
Showing 7 changed files with 121 additions and 1 deletion.
2 changes: 1 addition & 1 deletion serverless.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ provider:
ummServiceVersion: '1.3.4'
ummSubscriptionVersion: '1.1'
ummToolVersion: '1.1'
ummVariableVersion: '1.8.1'
ummVariableVersion: '1.9.0'

vpc:
securityGroupIds:
Expand Down
27 changes: 27 additions & 0 deletions src/resolvers/__tests__/variable.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,25 @@ describe('Variable', () => {
}
},
umm: {
AdditionalIdentifiers: [],
DataType: 'Dolor Nullam Venenatis',
Definition: 'Cras mattis consectetur purus sit amet fermentum.',
Dimensions: {},
FillValues: [],
IndexRanges: {},
InstanceInformation: {},
LongName: 'Vehicula Aenean Lorem',
MeasurementIdentifiers: [],
Name: 'Vehicula',
Offset: 1.234,
RelatedURLs: [],
Scale: 1.234,
ScienceKeywords: [],
Sets: [],
StandardName: 'all values standard name',
Units: 'K',
ValidRanges: {},
VariableSubType: 'SCIENCE_SCALAR',
VariableType: 'Malesuada'
}
}]
Expand All @@ -65,19 +74,28 @@ describe('Variable', () => {
variables {
count
items {
additionalIdentifiers
associationDetails
conceptId
dataType
definition
dimensions
fillValues
indexRanges
instanceInformation
longName
measurementIdentifiers
name
nativeId
offset
relatedUrls
scale
scienceKeywords
sets
standardName
units
validRanges
variableSubType
variableType
}
}
Expand All @@ -92,6 +110,7 @@ describe('Variable', () => {
variables: {
count: 1,
items: [{
additionalIdentifiers: [],
associationDetails: {
collections: [
{
Expand All @@ -103,14 +122,22 @@ describe('Variable', () => {
dataType: 'Dolor Nullam Venenatis',
definition: 'Cras mattis consectetur purus sit amet fermentum.',
dimensions: {},
fillValues: [],
indexRanges: {},
instanceInformation: {},
longName: 'Vehicula Aenean Lorem',
measurementIdentifiers: [],
name: 'Vehicula',
nativeId: 'test-guid',
offset: 1.234,
relatedUrls: [],
scale: 1.234,
scienceKeywords: [],
sets: [],
standardName: 'all values standard name',
units: 'K',
validRanges: {},
variableSubType: 'SCIENCE_SCALAR',
variableType: 'Malesuada'
}]
}
Expand Down
87 changes: 87 additions & 0 deletions src/resolvers/__tests__/variableDraft.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,93 @@ describe('Variable Draft', () => {
describe('Query', () => {
describe('variableDraft', () => {
describe('with results', () => {
test('all variable draft fields', async () => {
nock(/example/)
.defaultReplyHeaders({
'X-Request-Id': 'abcd-1234-efgh-5678'
})
.get(/api\/variable_drafts/)
.reply(200, {
draft: {
AdditionalIdentifiers: [],
DataType: 'byte',
Definition: 'Mock Definition',
Dimensions: {},
FillValues: [],
IndexRanges: {},
InstanceInformation: {},
LongName: 'Mock Long Name',
MeasurementIdentifiers: [],
Name: 'Mock Variable Draft Name',
Offset: 1.234,
RelatedURLs: [],
Scale: 1.234,
ScienceKeywords: [],
Sets: [],
StandardName: 'Mock Standard Name',
Units: 'K',
ValidRanges: {},
VariableSubType: 'SCIENCE_SCALAR',
VariableType: 'Mock Variable Types'
}
})
const response = await server.executeOperation({
variables: {},
query: `{
variableDraft (params: { id: 123 }) {
additionalIdentifiers
dataType
definition
dimensions
fillValues
indexRanges
instanceInformation
longName
measurementIdentifiers
name
offset
relatedUrls
scale
scienceKeywords
sets
standardName
units
validRanges
variableSubType
variableType
}
}`
}, {
contextValue
})

const { data } = response.body.singleResult

expect(data).toEqual({
variableDraft: {
additionalIdentifiers: [],
dataType: 'byte',
definition: 'Mock Definition',
dimensions: {},
fillValues: [],
indexRanges: {},
instanceInformation: {},
longName: 'Mock Long Name',
measurementIdentifiers: [],
name: 'Mock Variable Draft Name',
offset: 1.234,
relatedUrls: [],
scale: 1.234,
scienceKeywords: [],
sets: [],
standardName: 'Mock Standard Name',
units: 'K',
validRanges: {},
variableSubType: 'SCIENCE_SCALAR',
variableType: 'Mock Variable Types'
}
})
})
test('returns results', async () => {
nock(/example/)
.defaultReplyHeaders({
Expand Down
2 changes: 2 additions & 0 deletions src/types/variable.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ type Variable {
fillValues: JSON
"This element describes the x and y dimension ranges for this variable. Typically these values are 2 latitude and longitude ranges, but they don't necessarily have to be."
indexRanges: JSON
"Describes a store (zarr) where a variable has been separated from its original data files and saved as its own entity."
instanceInformation: JSON
"The expanded or long name related to the variable Name."
longName: String
"The measurement information of a variable."
Expand Down
2 changes: 2 additions & 0 deletions src/types/variableDraft.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ type VariableDraft {
fillValues: JSON
"This element describes the x and y dimension ranges for this variable. Typically these values are 2 latitude and longitude ranges, but they don't necessarily have to be."
indexRanges: JSON
"Describes a store (zarr) where a variable has been separated from its original data files and saved as its own entity."
instanceInformation: JSON
"The expanded or long name related to the variable Name."
longName: String
"The measurement information of a variable."
Expand Down
1 change: 1 addition & 0 deletions src/utils/umm/variableDraftKeyMap.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"dimensions": "Dimensions",
"fillValues": "FillValues",
"indexRanges": "IndexRanges",
"instanceInformation": "InstanceInformation",
"longName": "LongName",
"measurementIdentifiers": "MeasurementIdentifiers",
"name": "Name",
Expand Down
1 change: 1 addition & 0 deletions src/utils/umm/variableKeyMap.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"dimensions": "umm.Dimensions",
"fillValues": "umm.FillValues",
"indexRanges": "umm.IndexRanges",
"instanceInformation": "umm.InstanceInformation",
"longName": "umm.LongName",
"measurementIdentifiers": "umm.MeasurementIdentifiers",
"name": "umm.Name",
Expand Down

0 comments on commit d89ade4

Please sign in to comment.