-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Group tests to separate unit e2e tests. Add e2e test against my own b…
…shc.
- Loading branch information
Showing
6 changed files
with
100 additions
and
11 deletions.
There are no files selected for viewing
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,20 @@ | ||
<component name="ProjectRunConfigurationManager"> | ||
<configuration default="false" name="Tests E2E Template" type="mocha-javascript-test-runner"> | ||
<node-interpreter>project</node-interpreter> | ||
<node-options /> | ||
<mocha-package>$PROJECT_DIR$/node_modules/mocha</mocha-package> | ||
<working-directory>$PROJECT_DIR$</working-directory> | ||
<pass-parent-env>true</pass-parent-env> | ||
<envs> | ||
<env name="BSHC_CERT" value="" /> | ||
<env name="BSHC_HOST" value="" /> | ||
<env name="BSHC_PRIV" value="" /> | ||
</envs> | ||
<ui>bdd</ui> | ||
<extra-mocha-options>--grep e2e --exit</extra-mocha-options> | ||
<test-kind>DIRECTORY</test-kind> | ||
<test-directory>$PROJECT_DIR$/test</test-directory> | ||
<recursive>true</recursive> | ||
<method v="2" /> | ||
</configuration> | ||
</component> |
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
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
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,41 @@ | ||
import { BoschSmartHomeBridge, BoschSmartHomeBridgeBuilder, BshbUtils } from "../src"; | ||
import { expect } from "chai"; | ||
import { DefaultTestLogger } from "./bshc-mock"; | ||
|
||
const host: string = process.env.BSHC_HOST!; | ||
const identifier: string = process.env.BSHC_IDENTIFIER!; | ||
const password: string = process.env.BSHC_PWD!; | ||
const clientCert: string = "-----BEGIN CERTIFICATE-----\n" + process.env.BSHC_CERT! + "\n-----END CERTIFICATE-----"; | ||
const clientPrivateKey: string = | ||
"-----BEGIN RSA PRIVATE KEY-----\n" + process.env.BSHC_PRIV! + "\n-----END RSA PRIVATE KEY-----"; | ||
|
||
describe("BshbUtils", () => { | ||
let bshb: BoschSmartHomeBridge; | ||
before(() => { | ||
const certResult = BshbUtils.generateClientCertificate(); | ||
bshb = BoschSmartHomeBridgeBuilder.builder() | ||
.withHost(host) | ||
.withClientCert(clientCert) | ||
.withClientPrivateKey(clientPrivateKey) | ||
.withIgnoreCertificateCheck(true) | ||
.withLogger(new DefaultTestLogger()) | ||
.build(); | ||
}); | ||
|
||
it("e2e get rooms", (done) => { | ||
let response: any; | ||
bshb | ||
.getBshcClient() | ||
.getRooms() | ||
.subscribe({ | ||
next: (value) => (response = value), | ||
error: (error) => { | ||
expect.fail(error, "Expected that rooms returns a result"); | ||
}, | ||
complete: () => { | ||
expect(response).to.be.not.null; | ||
done(); | ||
}, | ||
}); | ||
}); | ||
}); |
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
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