Skip to content

Commit 1bafd8d

Browse files
author
Fabrizio Mirabito
committedJun 18, 2020
Run tests using GitHub actions
1 parent 71ce299 commit 1bafd8d

File tree

3 files changed

+37
-5
lines changed

3 files changed

+37
-5
lines changed
 

‎.github/workflows/test.yaml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: test
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- master
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Disable EOL conversions
14+
run: git config --global core.autocrlf false
15+
16+
- name: Checkout
17+
uses: actions/checkout@master
18+
19+
- name: Integration tests
20+
uses: actions/setup-node@v1
21+
with:
22+
node-version: '12'
23+
- run: npm install
24+
- run: npm run test
25+
env:
26+
CLIENT_ID: ${{ secrets.CLIENT_ID }}
27+
CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }}

‎jest.config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
module.exports = {
22
globals: {
3-
token: process.env.TOKEN,
3+
clientId: process.env.CLIENT_ID,
4+
clientSecret: process.env.CLIENT_SECRET,
45
},
56
verbose: true,
67
setupFiles: [

‎test/arduino-cloud.test.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
*/
2020
const { ArduinoIoTCloud, SenML } = require('../lib/index.js');
2121

22-
const deviceId = '1f4ced70-53ad-4b29-b221-1b0abbdfc757';
23-
const thingId = '2cea8542-d472-4464-859c-4ef4dfc7d1d3';
22+
const deviceId = '1e5b4cdd-57da-4c68-9dfd-439e493f7c79';
23+
const thingId = '82b903fe-4387-47ed-a503-201619b949fe';
2424
const propertyIntName = 'integer';
2525
const propertyIntValue = 22;
2626

@@ -37,7 +37,8 @@ describe('Test the library basic functionalities', () => {
3737
it('ArduinoCloud connection', (done) => {
3838
/* global token */
3939
ArduinoIoTCloud.connect({
40-
token,
40+
clientId,
41+
clientSecret,
4142
onDisconnect: (message) => {
4243
if (message.errorCode !== 0) {
4344
throw Error(message);
@@ -53,7 +54,10 @@ describe('Test the library basic functionalities', () => {
5354

5455
describe("when connected", () => {
5556
beforeEach((done) => {
56-
ArduinoIoTCloud.connect({ token }).then(() => done());
57+
ArduinoIoTCloud.connect({
58+
clientId,
59+
clientSecret,
60+
}).then(() => done());
5761
})
5862

5963
it('Property name must be a string in sendProperty', (done) => {

0 commit comments

Comments
 (0)
Please sign in to comment.