From b22f88e0444858bf8fd245f51fa0309613149c69 Mon Sep 17 00:00:00 2001 From: luke-hagar-sp <98849695+luke-hagar-sp@users.noreply.github.com> Date: Thu, 4 Aug 2022 15:41:00 -0500 Subject: [PATCH] Updating Tests --- package.json | 9 ++++++++- test/index.test.js | 22 ++++++++++++++++------ 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 8950af2..462683e 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,15 @@ { "name": "plex-api-oauth", - "version": "1.2.6", + "version": "1.2.7", "description": "An NPM Module designed to make Plex Media Server and plex.tv API calls easier to implement in JavaScript and React projects", "main": "./src/index.js", + "keywords": [ + "plex", + "plex-api", + "OAuth", + "Plex", + "API" + ], "type": "module", "scripts": { "test": "mocha ./test/index.test.js" diff --git a/test/index.test.js b/test/index.test.js index 4ed7f56..2627300 100644 --- a/test/index.test.js +++ b/test/index.test.js @@ -4,21 +4,29 @@ import { PlexLogin, GetPlexUserData, } from "../src/index.js"; -import React from "React"; describe("Unit Tests", function () { let emptyArray = []; - it("Generate ClientId and Login", async function () { - this.timeout(10000); - let plexSession = await PlexLogin(plexClientInformation); + var plexClientInformation; + var plexSession; + + before(function (done) { + plexClientInformation = CreatePlexClientInformation(); + plexSession = PlexLogin(plexClientInformation); + done(); + }); + + it("Generate ClientId and Login", async function (done) { + this.timeout(3000); assert.notEqual(plexSession.plexTVAuthToken, null); assert.notEqual(plexSession.plexTVAuthToken, undefined); assert.notEqual(plexSession.plexClientInformation, null); assert.notEqual(plexSession.plexClientInformation, undefined); console.log("Client Info and Auth Token"); console.log(plexSession); + done(); }); - it("Get Plex User Data", async function () { + it("Get Plex User Data", async function (done) { this.timeout(5000); let plexSession = await PlexLogin(plexClientInformation); let plexTVUserData = await GetPlexUserData(plexSession); @@ -26,8 +34,9 @@ describe("Unit Tests", function () { assert.notEqual(plexTVUserData, null); console.log("User Data"); console.log(plexTVUserData); + done(); }); - it("Get Plex Servers", async function () { + it("Get Plex Servers", async function (done) { this.timeout(12000); let plexSession = await PlexLogin(plexClientInformation); let plexTVUserData = await GetPlexUserData(plexSession); @@ -37,6 +46,7 @@ describe("Unit Tests", function () { assert.notEqual(plexServers, undefined); console.log("Plex Servers"); console.log(plexServers); + done(); }); // it("Get Plex Libraries", async function () { // this.timeout(10000);