-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add testing led api getting the sdk version
- Loading branch information
Showing
4 changed files
with
58 additions
and
0 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,3 @@ | ||
export { | ||
runLedTests, | ||
} from './run-tests'; |
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,34 @@ | ||
import { led } from '../..'; | ||
import { getDestroyPromise } from '../../error'; | ||
|
||
|
||
let isRunning = false; | ||
function init() | ||
{ | ||
const success = led.init(); | ||
console.log('success:', success); | ||
|
||
if (!isRunning) | ||
{ | ||
isRunning = true; | ||
getDestroyPromise().then(() => shutdown()); | ||
} | ||
} | ||
|
||
export function shutdown() | ||
{ | ||
if (isRunning) | ||
{ | ||
console.log('shutting down old api'); | ||
led.shutdown(); | ||
isRunning = false; | ||
} | ||
} | ||
|
||
export function testColor() | ||
{ | ||
init(); | ||
|
||
const sdkVersion = led.getSdkVersion(); | ||
console.log('sdkVersion:', sdkVersion && sdkVersion.toString()); | ||
} |
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,13 @@ | ||
import { executeTest } from '../test-helper'; | ||
// import * as tests from './logi-led'; | ||
import * as oldTests from './old-api'; | ||
|
||
|
||
export async function runLedTests() | ||
{ | ||
console.log('Old API'); | ||
console.log('---'); | ||
|
||
await executeTest('getting the sdk version', oldTests.testColor, 10e3); | ||
oldTests.shutdown(); | ||
} |
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