-
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.
* Create node.js.yml Git hub actions for Sample App tests * update * added time out * supported Node.js * formatting * formatting * formatting * formatting * formatting * formatting * formatting * changes * changes * changes * changes * changes * changes * changes * changes * changes * changes * changes * changes * changes * changes * mock cors * config * changes * changes * changes * changes * changes * changes * changes * changes * changes * changes * changes * changes * last changes
- Loading branch information
1 parent
402b1f2
commit 14eb777
Showing
13 changed files
with
242 additions
and
13 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,49 @@ | ||
name: Node.js CI | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
pull_request: | ||
branches: [ "main" ] | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: [self-hosted, bionic] | ||
timeout-minutes: 10 | ||
defaults: | ||
run: | ||
working-directory: 'sample-app/Client' | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
# TEMPORARY until we get a runner on ubuntu focal (20.4) or jammy (22.4) | ||
- name: Install Sonos Node | ||
run: | | ||
wget https://packages.sonos.com/bootstrap-no-check.sh | ||
chmod +x bootstrap-no-check.sh | ||
sudo ./bootstrap-no-check.sh | ||
sudo apt install -y sonos-nodejs-18.12.1 | ||
sudo rm /usr/bin/node | ||
sudo ln -s /usr/local/nodejs-18.12.1/bin/node /usr/bin/node | ||
sudo rm /usr/bin/npm | ||
sudo ln -s /usr/local/nodejs-18.12.1/bin/npm /usr/bin/npm | ||
# Proper way to setup node once we have a more updated ubuntu runner | ||
# - name: Setup Node | ||
# uses: actions/setup-node@v3 | ||
# with: ${{ env.NODE_VERSION }} | ||
|
||
- name: Install dependencies | ||
run: npm ci | ||
working-directory: 'sample-app/Client' | ||
|
||
- name: Run mock Server | ||
run: node mock-cors.js & | ||
working-directory: 'sample-app/Test-cors' | ||
|
||
- name: Run tests | ||
run: npm test | ||
working-directory: 'sample-app/Client' |
File renamed without changes.
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 |
---|---|---|
@@ -1,17 +1,23 @@ | ||
import { render } from "@testing-library/react"; | ||
import { render, screen } from "@testing-library/react"; | ||
import GetGroups from "../UserDetails/getGroups"; | ||
import { Configuration } from "../museClient/configuration"; | ||
import testConfig from "./testConfig.json"; | ||
import {RecoilRoot} from 'recoil'; | ||
import '@testing-library/jest-dom'; | ||
|
||
test("testing the getGroups API", () => { | ||
const testHouseholdID = testConfig.householdID; | ||
const testMuseClientConfig = new Configuration({ | ||
accessToken: testConfig.authToken | ||
}); | ||
render( | ||
<GetGroups | ||
householdId={testHouseholdID} | ||
museClientConfig={testMuseClientConfig} | ||
/> | ||
<RecoilRoot> | ||
<GetGroups | ||
showLoadingScreen={true} | ||
householdId={testHouseholdID} | ||
museClientConfig={testMuseClientConfig} | ||
/> | ||
</RecoilRoot> | ||
); | ||
expect(screen.getByTestId('custom-element')).toBeVisible(); | ||
}); |
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
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,71 @@ | ||
{ | ||
"_objectType": "groups", | ||
"groups": [ | ||
{ | ||
"_objectType": "group", | ||
"id": "RINCON_2439B3B3BDC4290:6783439021", | ||
"name": "Sonos Roam", | ||
"coordinatorId": "RINCON_2439B3B3BDC4290", | ||
"playbackState": "PLAYBACK_STATE_IDLE", | ||
"playerIds": [ | ||
"RINCON_2439B3B3BDC4290" | ||
] | ||
}, | ||
{ | ||
"_objectType": "group", | ||
"id": "RINCON_2439B3B3BDC4290:6783439021", | ||
"name": "Bedroom", | ||
"coordinatorId": "RINCON_2439B3B3BDC4290", | ||
"playbackState": "PLAYBACK_STATE_PLAYING", | ||
"playerIds": [ | ||
"RINCON_2439B3B3BDC4290" | ||
] | ||
} | ||
], | ||
"players": [ | ||
{ | ||
"_objectType": "player", | ||
"id": "RINCON_2439B3B3BDC4290", | ||
"name": "Sonos Roam", | ||
"websocketUrl": "wss://192.168.1.45:1443/websocket/api", | ||
"softwareVersion": "75.1-43188-main_release", | ||
"apiVersion": "1.36.0-alpha.10", | ||
"minApiVersion": "1.1.0", | ||
"isUnregistered": false, | ||
"capabilities": [ | ||
"CLOUD", | ||
"PLAYBACK", | ||
"AIRPLAY", | ||
"VOICE", | ||
"AUDIO_CLIP" | ||
], | ||
"deviceIds": [ | ||
"RINCON_2439B3B3BDC4290" | ||
] | ||
}, | ||
{ | ||
"_objectType": "player", | ||
"id": "RINCON_2439B3B3BDC4290", | ||
"name": "Bedroom", | ||
"websocketUrl": "wss://192.168.1.81:1443/websocket/api", | ||
"softwareVersion": "76.1-43310-main_release", | ||
"apiVersion": "1.37.0-alpha.7", | ||
"minApiVersion": "1.1.0", | ||
"isUnregistered": false, | ||
"capabilities": [ | ||
"CLOUD", | ||
"HT_PLAYBACK", | ||
"PLAYBACK", | ||
"HT_POWER_STATE", | ||
"AIRPLAY", | ||
"VOICE", | ||
"AUDIO_CLIP", | ||
"HDMI" | ||
], | ||
"deviceIds": [ | ||
"RINCON_2439B3B3BDC4290" | ||
] | ||
} | ||
], | ||
"partial": 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,9 @@ | ||
{ | ||
"households": [ | ||
{ | ||
"id": "Sonos_iHJBfvUzznmHiuYmP2aT18usVp.NoCK8hTDBL4BUwR8k2Fe", | ||
"name": null, | ||
"ownerLuid": "364896036" | ||
} | ||
] | ||
} |
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,26 @@ | ||
const http = require('http'); | ||
const { url } = require('inspector'); | ||
const fs = require('fs') | ||
|
||
const hostname = '127.0.0.1' | ||
const port = 8090 | ||
|
||
const server = http.createServer((req, res) => { | ||
res.statusCode = 200; | ||
res.setHeader('Content-Type', 'text/plain'); | ||
if(req.url.includes('groups')) | ||
{ | ||
//this is a mock group response statement | ||
const fileContent = fs.readFileSync('./group.txt', 'utf-8'); | ||
res.end(fileContent); | ||
} else { | ||
//this is a mock household response statement | ||
const fileContent = fs.readFileSync('./household.txt', 'utf-8'); | ||
res.end(fileContent); | ||
} | ||
|
||
}); | ||
|
||
server.listen(port, hostname, () => { | ||
console.log(`Server running at http://${hostname}:${port}/`); | ||
}); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,11 @@ | ||
{ | ||
"dependencies": { | ||
"cors-anywhere": "0.4.4", | ||
"http-proxy": "1.11.1", | ||
"proxy-from-env": "0.0.1" | ||
}, | ||
"scripts": { | ||
"start": "npm run server", | ||
"server": "node cors-format.js" | ||
} | ||
} |