not ready for the BS that is typescript

This commit is contained in:
luke-hagar-sp
2022-07-26 18:53:58 -05:00
parent 08aaaf87ae
commit 533aa20ff8
6 changed files with 1354 additions and 382 deletions

View File

@@ -1,12 +1,41 @@
import { PlexAPIOAuth, PlexLogin } from "./index.mjs";
import { PlexAPIOAuth } from "../src/index.js";
import { strict as assert } from "assert";
describe("Login Test", function () {
let plexapioauth = new PlexAPIOAuth();
it("should be able to fail login", function () {
console.log(plexapioauth);
plexapioauth.generateClientId();
console.log(plexapioauth);
assert.strictEqual(PlexLogin(plexapioauth.plexClientInformation), null);
let PlexSession = new PlexAPIOAuth();
let emptyArray = [];
it("Generate ClientId", function () {
PlexSession.GenerateClientId();
assert.notEqual(PlexSession.clientId, null);
assert.notEqual(PlexSession.clientId, undefined);
console.log("Plex Session");
console.log(PlexSession);
});
it("Login", async function () {
this.timeout(10000);
let response = await PlexSession.PlexLogin();
assert.notEqual(PlexSession.plexTVAuthToken, undefined);
assert.notEqual(response, undefined);
console.log("Auth Token");
console.log(PlexSession.plexTVAuthToken);
});
it("Get Plex User Data", async function () {
this.timeout(5000);
let response = await PlexSession.GetPlexUserData();
assert.notEqual(PlexSession.plexTVUserData, undefined);
assert.notEqual(response, undefined);
console.log("User Data");
console.log(PlexSession.plexTVUserData);
});
it("Get Plex Servers", async function () {
this.timeout(10000);
let response = await PlexSession.GetPlexServers();
assert.notEqual(PlexSession.plexServers, emptyArray);
assert.notEqual(PlexSession.plexServers, null);
assert.notEqual(PlexSession.plexServers, undefined);
assert.notEqual(PlexSession.plexDevices, emptyArray);
assert.notEqual(response, null);
console.log("Plex Servers");
console.log(PlexSession.plexServers);
});
});