Skip to content

Run tests using GH actions #236

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: test

on:
pull_request:
push:
branches:
- master

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Disable EOL conversions
run: git config --global core.autocrlf false

- name: Checkout
uses: actions/checkout@master

- name: Integration tests
uses: actions/setup-node@v1
with:
node-version: '12'
- run: npm install
- run: npm run lint
- run: npm run test
env:
CLIENT_ID: ${{ secrets.CLIENT_ID }}
CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }}
3 changes: 2 additions & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
module.exports = {
globals: {
token: process.env.TOKEN,
clientId: process.env.CLIENT_ID,
clientSecret: process.env.CLIENT_SECRET,
},
verbose: true,
setupFiles: [
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"clean": "rimraf lib es",
"build:es": "rollup -c",
"build:lib": "rollup -c ./rollup.config.lib.js",
"build": "npm run clean && npm run lint && npm run build:es && npm run build:lib"
"build": "npm run clean && npm run build:es && npm run build:lib"
},
"repository": {
"type": "git",
Expand Down
12 changes: 8 additions & 4 deletions test/arduino-cloud.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
*/
const { ArduinoIoTCloud, SenML } = require('../lib/index.js');

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

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

describe("when connected", () => {
beforeEach((done) => {
ArduinoIoTCloud.connect({ token }).then(() => done());
ArduinoIoTCloud.connect({
clientId,
clientSecret,
}).then(() => done());
})

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