This repository has been archived by the owner on Nov 22, 2019. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TTOOLS-404 Adds unit tests for models
- Loading branch information
Showing
10 changed files
with
551 additions
and
178 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
ngapp/src/app/connections/shared/connection-status.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { ConnectionStatus } from "@connections/shared/connection-status"; | ||
|
||
describe("ConnectionStatus", () => { | ||
let connectionStatus: ConnectionStatus; | ||
|
||
beforeEach(() => { | ||
connectionStatus = null; | ||
}); | ||
|
||
it("should create", () => { | ||
console.log("========== [ConnectionStatus] should create"); | ||
connectionStatus = ConnectionStatus.create( | ||
{ | ||
"connectionName": "PgConn", | ||
"vdbState": "ACTIVE", | ||
"schemaState": "ACTIVE", | ||
"errors": [], | ||
"schemaModelName": "pgconnschemamodel", | ||
"schemaVdbName": "pgconnschemavdb", | ||
"vdbName": "pgconnbtlconn" | ||
} | ||
); | ||
|
||
expect(connectionStatus.getConnectionName()).toEqual("PgConn"); | ||
expect(connectionStatus.getSchemaModelName()).toEqual("pgconnschemamodel"); | ||
expect(connectionStatus.getSchemaVdbName()).toEqual("pgconnschemavdb"); | ||
expect(connectionStatus.getServerVdbName()).toEqual("pgconnbtlconn"); | ||
expect(connectionStatus.getErrors()).toEqual([]); | ||
expect(connectionStatus.isServerVdbActive()).toEqual(true); | ||
expect(connectionStatus.isServerVdbMissing()).toEqual(false); | ||
expect(connectionStatus.isServerVdbLoading()).toEqual(false); | ||
expect(connectionStatus.isServerVdbFailed()).toEqual(false); | ||
}); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import { Connection } from "@connections/shared/connection.model"; | ||
|
||
describe("Connection", () => { | ||
let connection: Connection; | ||
|
||
beforeEach(() => { | ||
connection = null; | ||
}); | ||
|
||
it("should create", () => { | ||
console.log("========== [Connection] should create"); | ||
connection = Connection.create( | ||
{ | ||
"keng__baseUri": "http://das-beetle-studio.192.168.42.154.nip.io/vdb-builder/v1/", | ||
"keng__id": "PgConn", | ||
"keng__dataPath": "/tko:komodo/tko:workspace/admin/PgConn", | ||
"keng__kType": "Connection", | ||
"keng__hasChildren": true, | ||
"dv__jndiName": "java:/postgresql-persistent-jq7wz", | ||
"dv__driverName": "postgresql", | ||
"dv__type": true, | ||
"keng__properties": [ | ||
{ | ||
"name": "description", | ||
"value": "customer db on postgres" | ||
}, | ||
{ | ||
"name": "serviceCatalogSource", | ||
"value": "postgresql-persistent-jq7wz" | ||
} | ||
], | ||
"keng___links": [ | ||
{ | ||
"rel": "self", | ||
"href": "http://das-beetle-studio.192.168.42.154.nip.io/vdb-builder/v1/workspace/connections/PgConn" | ||
}, | ||
{ | ||
"rel": "parent", | ||
"href": "http://das-beetle-studio.192.168.42.154.nip.io/vdb-builder/v1/workspace/connections" | ||
}, | ||
{ | ||
"rel": "children", | ||
"href": "http://das-beetle-studio.192.168.42.154.nip.io/vdb-builder/v1/workspace/search%2Fadmin%2FPgConn" | ||
} | ||
] | ||
} | ||
); | ||
|
||
expect(connection.getId()).toEqual("PgConn"); | ||
expect(connection.getDescription()).toEqual("customer db on postgres"); | ||
expect(connection.getDriverName()).toEqual("postgresql"); | ||
expect(connection.getJndiName()).toEqual("java:/postgresql-persistent-jq7wz"); | ||
expect(connection.getServiceCatalogSourceName()).toEqual("postgresql-persistent-jq7wz"); | ||
expect(connection.getDataPath()).toEqual("/tko:komodo/tko:workspace/admin/PgConn"); | ||
}); | ||
|
||
}); |
45 changes: 45 additions & 0 deletions
45
ngapp/src/app/connections/shared/service-catalog-source.model.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { ServiceCatalogSource } from "@connections/shared/service-catalog-source.model"; | ||
|
||
describe("ServiceCatalogSource", () => { | ||
let serviceCatSrc: ServiceCatalogSource; | ||
|
||
beforeEach(() => { | ||
serviceCatSrc = null; | ||
}); | ||
|
||
it("should create", () => { | ||
console.log("========== [ServiceCatalogSource] should create"); | ||
serviceCatSrc = ServiceCatalogSource.create( | ||
{ | ||
"keng__baseUri": "http://das-beetle-studio.192.168.42.154.nip.io/vdb-builder/v1/", | ||
"keng__id": "mongodb-persistent-762zc", | ||
"keng__dataPath": "/tko:komodo/tko:workspace/admin/2018-05-17_20-35-29-543", | ||
"keng__kType": "ServiceCatalogDataSource", | ||
"keng__hasChildren": false, | ||
"sc__name": "mongodb-persistent-762zc", | ||
"sc__type": "mongodb", | ||
"sc__bound": true, | ||
"sc__translator": "mongodb", | ||
"keng___links": [ | ||
{ | ||
"rel": "self", | ||
"href": "http://das-beetle-studio.192.168.42.154.nip.io/vdb-builder/v1/metadata/connections/mongodb-persistent-762zc" | ||
}, | ||
{ | ||
"rel": "parent", | ||
"href": "http://das-beetle-studio.192.168.42.154.nip.io/vdb-builder/v1/metadata/connections" | ||
}, | ||
{ | ||
"rel": "children", | ||
"href": "http://das-beetle-studio.192.168.42.1154.nip.ip/xxx" | ||
} | ||
] | ||
} | ||
); | ||
|
||
expect(serviceCatSrc.getName()).toEqual("mongodb-persistent-762zc"); | ||
expect(serviceCatSrc.getType()).toEqual("mongodb"); | ||
expect(serviceCatSrc.isBound()).toEqual(true); | ||
}); | ||
|
||
}); |
87 changes: 0 additions & 87 deletions
87
ngapp/src/app/connections/shared/template-definition.model.ts
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
74 changes: 74 additions & 0 deletions
74
ngapp/src/app/dataservices/shared/connection-summary.model.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
import { ConnectionSummary } from "@dataservices/shared/connection-summary.model"; | ||
|
||
describe("ConnectionSummary", () => { | ||
let connectionSummary: ConnectionSummary; | ||
|
||
beforeEach(() => { | ||
connectionSummary = null; | ||
}); | ||
|
||
it("should create", () => { | ||
console.log("========== [ConnectionSummary] should create"); | ||
connectionSummary = ConnectionSummary.create( | ||
{ | ||
"connection": { | ||
"keng__baseUri": "http://das-beetle-studio.192.168.42.154.nip.io/vdb-builder/v1/", | ||
"keng__id": "PgConn", | ||
"keng__dataPath": "/tko:komodo/tko:workspace/admin/PgConn", | ||
"keng__kType": "Connection", | ||
"keng__hasChildren": true, | ||
"dv__jndiName": "java:/postgresql-persistent-jq7wz", | ||
"dv__driverName": "postgresql", | ||
"dv__type": true, | ||
"keng__properties": [ | ||
{ | ||
"name": "description", | ||
"value": "customer db on postgres" | ||
}, | ||
{ | ||
"name": "serviceCatalogSource", | ||
"value": "postgresql-persistent-jq7wz" | ||
} | ||
], | ||
"keng___links": [ | ||
{ | ||
"rel": "self", | ||
"href": "http://das-beetle-studio.192.168.42.154.nip.io/vdb-builder/v1/workspace/connections/PgConn" | ||
}, | ||
{ | ||
"rel": "parent", | ||
"href": "http://das-beetle-studio.192.168.42.154.nip.io/vdb-builder/v1/workspace/connections" | ||
}, | ||
{ | ||
"rel": "children", | ||
"href": "http://das-beetle-studio.192.168.42.154.nip.io/vdb-builder/v1/workspace/search%2Fadmin%2FPgConn" | ||
} | ||
] | ||
}, | ||
"status": { | ||
"connectionName": "PgConn", | ||
"vdbState": "ACTIVE", | ||
"schemaState": "ACTIVE", | ||
"errors": [], | ||
"schemaModelName": "pgconnschemamodel", | ||
"schemaVdbName": "pgconnschemavdb", | ||
"vdbName": "pgconnbtlconn" | ||
} | ||
} | ||
); | ||
|
||
expect(connectionSummary.getConnection().getId()).toEqual("PgConn"); | ||
expect(connectionSummary.getConnection().getDescription()).toEqual("customer db on postgres"); | ||
expect(connectionSummary.getConnection().getDriverName()).toEqual("postgresql"); | ||
expect(connectionSummary.getConnection().getJndiName()).toEqual("java:/postgresql-persistent-jq7wz"); | ||
expect(connectionSummary.getConnection().getServiceCatalogSourceName()).toEqual("postgresql-persistent-jq7wz"); | ||
expect(connectionSummary.getConnection().getDataPath()).toEqual("/tko:komodo/tko:workspace/admin/PgConn"); | ||
|
||
expect(connectionSummary.getStatus().getConnectionName()).toEqual("PgConn"); | ||
expect(connectionSummary.getStatus().getSchemaModelName()).toEqual("pgconnschemamodel"); | ||
expect(connectionSummary.getStatus().getSchemaVdbName()).toEqual("pgconnschemavdb"); | ||
expect(connectionSummary.getStatus().getServerVdbName()).toEqual("pgconnbtlconn"); | ||
expect(connectionSummary.getStatus().getErrors()).toEqual([]); | ||
}); | ||
|
||
}); |
Oops, something went wrong.