Permalink
Browse files

fix(v2): consider the server type when comparing the version numbers

  • Loading branch information...
j-white committed Jul 13, 2017
1 parent 045d157 commit e2c03eefd14f174e4c7721a627712b42726b5d07
Showing with 42 additions and 21 deletions.
  1. +5 −1 src/api/ServerMetadata.ts
  2. +37 −20 test/api/ServerMetadata.spec.ts
@@ -53,7 +53,11 @@ export class ServerMetadata {
/** what version of the ReST API does this server support */
public apiVersion() {
return this.version.ge('21.0.0') ? 2 : 1;
if (this.type && this.type === ServerTypes.MERIDIAN) {
return this.version.ge('2017.1.0') ? 2 : 1;
} else {
return this.version.ge('21.0.0') ? 2 : 1;
}
}
/** a convenient data structure with all capabilities listed */
@@ -10,79 +10,96 @@ const expectedResults = {
'0.0.0': {
newObject: ['0.0.0', undefined],
tests: {
serverType: ServerTypes.HORIZON,
capabilities: {
ackAlarms: false,
apiVersion: 1,
graphs: false,
outageSummaries: false,
setNodeLocation: false,
}
}
},
serverType: ServerTypes.HORIZON,
},
},
'14.0.3': {
newObject: ['14.0.3', undefined],
tests: {
serverType: ServerTypes.HORIZON,
capabilities: {
ackAlarms: true,
apiVersion: 1,
graphs: false,
outageSummaries: true,
setNodeLocation: false,
}
}
},
serverType: ServerTypes.HORIZON,
},
},
'15.0.0': {
newObject: ['15.0.0', undefined],
tests: {
serverType: ServerTypes.HORIZON,
capabilities: {
ackAlarms: true,
apiVersion: 1,
graphs: false,
outageSummaries: true,
setNodeLocation: false,
}
}
},
serverType: ServerTypes.HORIZON,
},
},
'15.0.2': {
newObject: ['15.0.2', undefined],
tests: {
serverType: ServerTypes.HORIZON,
capabilities: {
ackAlarms: true,
apiVersion: 1,
graphs: false,
outageSummaries: true,
setNodeLocation: true,
}
}
},
serverType: ServerTypes.HORIZON,
},
},
'16.0.0': {
newObject: ['16.0.0', undefined],
tests: {
serverType: ServerTypes.HORIZON,
capabilities: {
ackAlarms: true,
apiVersion: 1,
graphs: true,
outageSummaries: true,
setNodeLocation: true,
}
}
},
serverType: ServerTypes.HORIZON,
},
},
'2015.1.0': {
newObject: ['2015.1.0', ServerTypes.MERIDIAN],
tests: {
serverType: ServerTypes.MERIDIAN,
capabilities: {
ackAlarms: true,
apiVersion: 1,
graphs: false,
outageSummaries: true,
setNodeLocation: true,
}
}
},
serverType: ServerTypes.MERIDIAN,
},
},
'21.0.0': {
newObject: ['21.0.0', undefined],
tests: {
capabilities: {
ackAlarms: true,
apiVersion: 2,
graphs: true,
outageSummaries: true,
setNodeLocation: true,
},
serverType: ServerTypes.HORIZON,
},
},
};
//console.log(JSON.stringify(expectedResults, undefined, 5));
for (let ver in expectedResults) {
let suite = expectedResults[ver];

0 comments on commit e2c03ee

Please sign in to comment.