Skip to content

πŸ“ˆ Get real-time stocks from TradingView

Try to fix GH Actions

Mathieu Colmon8f110ebe9e80
diff --git a/tests/09. AllErrors.js b/tests/09. AllErrors.js
index 701fcf7..da89fae 100644
--- a/tests/09. AllErrors.js
+++ b/tests/09. AllErrors.js
@@ -138,6 +138,13 @@ module.exports = async (log, success, warn, err, cb) => {
async (next) => { /* Testing "Wrong or expired sessionid/signature" using getUser method */
log('Testing "Wrong or expired sessionid/signature" error using getUser method:');
+
+ if (!process.env.SESSION) {
+ warn('=> Skipping test because no sessionid/signature was provided');
+ next();
+ return;
+ }
+
try {
await TradingView.getUser(process.env.SESSION);
err('=> User found !');
@@ -150,6 +157,12 @@ module.exports = async (log, success, warn, err, cb) => {
async (next) => { /* Testing "Wrong or expired sessionid/signature" using client */
log('Testing "Wrong or expired sessionid/signature" error using client:');
+ if (!process.env.SESSION) {
+ warn('=> Skipping test because no sessionid/signature was provided');
+ next();
+ return;
+ }
+
log('Creating a new client...');
const client2 = new TradingView.Client({
token: process.env.SESSION,
diff --git a/tests/10. Authenticated.js b/tests/10. Authenticated.js
index b6c6bea..5d98963 100644
--- a/tests/10. Authenticated.js
+++ b/tests/10. Authenticated.js
@@ -5,6 +5,12 @@ const TradingView = require('../main');
const wait = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
module.exports = async (log, success, warn, err, cb) => {
+ if (!process.env.SESSION || !process.env.SIGNATURE) {
+ err('No sessionid/signature was provided');
+ cb();
+ return;
+ }
+
log('Getting user info');
const userInfos = await TradingView.getUser(process.env.SESSION, process.env.SIGNATURE);