Add prettier and re-format .js files

This commit is contained in:
hensm
2021-08-31 07:59:58 +01:00
parent 9339b1a306
commit d6ca1325dc
38 changed files with 908 additions and 13254 deletions

View File

@@ -16,17 +16,19 @@ describe("chrome.cast.ApiConfig", () => {
it("should have expected assigned properties", async () => {
const sessionRequest = new chrome.cast.SessionRequest(
chrome.cast.media.DEFAULT_MEDIA_RECEIVER_APP_ID);
chrome.cast.media.DEFAULT_MEDIA_RECEIVER_APP_ID
);
function sessionListener () {}
function receiverListener () {}
function sessionListener() {}
function receiverListener() {}
const apiConfig = new chrome.cast.ApiConfig(
sessionRequest
, sessionListener
, receiverListener
, chrome.cast.AutoJoinPolicy.ORIGIN_SCOPED
, chrome.cast.DefaultActionPolicy.CAST_THIS_TAB);
sessionRequest,
sessionListener,
receiverListener,
chrome.cast.AutoJoinPolicy.ORIGIN_SCOPED,
chrome.cast.DefaultActionPolicy.CAST_THIS_TAB
);
expect(typeof apiConfig.sessionListener).toBe("function");
expect(typeof apiConfig.receiverListener).toBe("function");

View File

@@ -10,8 +10,9 @@ describe("chrome.cast.DialRequest", () => {
it("should have expected assigned properties", async () => {
const dialRequest = new chrome.cast.DialRequest(
"testAppName"
, "testLaunchParameter");
"testAppName",
"testLaunchParameter"
);
expect(dialRequest.appName).toBe("testAppName");
expect(dialRequest.launchParameter).toBe("testLaunchParameter");

View File

@@ -11,13 +11,13 @@ describe("chrome.cast.Error", () => {
it("should have expected assigned properties", async () => {
const error = new chrome.cast.Error(
chrome.cast.ErrorCode.CANCEL
, "testErrorDescription"
, { testErrorDetails: "testErrorDetails" });
chrome.cast.ErrorCode.CANCEL,
"testErrorDescription",
{ testErrorDetails: "testErrorDetails" }
);
expect(error.code).toBe("cancel");
expect(error.description).toBe("testErrorDescription");
expect(error.details).toEqual(
{ testErrorDetails: "testErrorDetails" });
expect(error.details).toEqual({ testErrorDetails: "testErrorDetails" });
});
});

View File

@@ -15,15 +15,20 @@ describe("chrome.cast.Receiver", () => {
it("should have expected assigned properties", async () => {
const receiver = new chrome.cast.Receiver(
"testLabel"
, "testFriendlyName"
, [ chrome.cast.Capability.VIDEO_OUT
, chrome.cast.Capability.AUDIO_OUT ]
, new chrome.cast.Volume(1, false));
"testLabel",
"testFriendlyName",
[
chrome.cast.Capability.VIDEO_OUT,
chrome.cast.Capability.AUDIO_OUT
],
new chrome.cast.Volume(1, false)
);
expect(receiver.capabilities).toEqual([ "video_out", "audio_out" ]);
expect(receiver.capabilities).toEqual(["video_out", "audio_out"]);
expect(receiver.friendlyName).toBe("testFriendlyName");
expect(receiver.label).toBe("testLabel");
expect(receiver.volume).toEqual(jasmine.objectContaining({ level: 1, muted: false }));
expect(receiver.volume).toEqual(
jasmine.objectContaining({ level: 1, muted: false })
);
});
});

View File

@@ -2,8 +2,7 @@
describe("chrome.cast.ReceiverDisplayStatus", () => {
it("should have all properties", async () => {
const receiverDisplayStatus =
new chrome.cast.ReceiverDisplayStatus();
const receiverDisplayStatus = new chrome.cast.ReceiverDisplayStatus();
expect(typeof receiverDisplayStatus.appImages).toBe("undefined");
expect(typeof receiverDisplayStatus.statusText).toBe("undefined");
@@ -12,14 +11,27 @@ describe("chrome.cast.ReceiverDisplayStatus", () => {
it("should have expected assigned properties", async () => {
const receiverDisplayStatus = new chrome.cast.ReceiverDisplayStatus(
"testStatusText"
, [
new chrome.cast.Image("http://example.com/1")
, new chrome.cast.Image("http://example.com/2")
]);
"testStatusText",
[
new chrome.cast.Image("http://example.com/1"),
new chrome.cast.Image("http://example.com/2")
]
);
expect(receiverDisplayStatus.statusText).toBe("testStatusText");
expect(receiverDisplayStatus.appImages).toContain(jasmine.objectContaining({ url: "http://example.com/1", height: null, width: null }))
expect(receiverDisplayStatus.appImages).toContain(jasmine.objectContaining({ url: "http://example.com/2", height: null, width: null }))
expect(receiverDisplayStatus.appImages).toContain(
jasmine.objectContaining({
url: "http://example.com/1",
height: null,
width: null
})
);
expect(receiverDisplayStatus.appImages).toContain(
jasmine.objectContaining({
url: "http://example.com/2",
height: null,
width: null
})
);
});
});

View File

@@ -11,7 +11,8 @@ describe("chrome.cast.SenderApplication", () => {
it("should have expected assigned properties", async () => {
const senderApplication = new chrome.cast.SenderApplication(
chrome.cast.SenderPlatform.CHROME);
chrome.cast.SenderPlatform.CHROME
);
expect(senderApplication.platform).toBe("chrome");
});

View File

@@ -19,16 +19,19 @@ describe("chrome.cast.Session", () => {
it("should have expected assigned properties", async () => {
const session = new chrome.cast.Session(
"__sessionId"
, "__appId"
, "__displayName"
, [ new chrome.cast.Image("http://example.com") ]
, new chrome.cast.Receiver("__label", "__friendlyName"));
"__sessionId",
"__appId",
"__displayName",
[new chrome.cast.Image("http://example.com")],
new chrome.cast.Receiver("__label", "__friendlyName")
);
expect(session.appId).toBe("__appId");
expect(session.appImages).toEqual(jasmine.arrayContaining([
jasmine.objectContaining({ url: "http://example.com" })
]));
expect(session.appImages).toEqual(
jasmine.arrayContaining([
jasmine.objectContaining({ url: "http://example.com" })
])
);
expect(session.displayName).toBe("__displayName");
expect(session.receiver).toEqual(jasmine.any(chrome.cast.Receiver));
expect(session.sessionId).toBe("__sessionId");

View File

@@ -5,7 +5,7 @@ describe("chrome.cast.SessionRequest", () => {
const sessionRequest = new chrome.cast.SessionRequest();
expect(sessionRequest.appId).toBe(undefined);
expect(sessionRequest.capabilities).toEqual([ "video_out", "audio_out" ]);
expect(sessionRequest.capabilities).toEqual(["video_out", "audio_out"]);
expect(sessionRequest.dialRequest).toBe(null);
expect(sessionRequest.language).toBe(null);
expect(sessionRequest.requestSessionTimeout).toBe(60000);
@@ -13,13 +13,13 @@ describe("chrome.cast.SessionRequest", () => {
it("should have expected assigned properties", async () => {
const sessionRequest = new chrome.cast.SessionRequest(
"__appId"
, [ chrome.cast.Capability.VIDEO_OUT
, chrome.cast.Capability.AUDIO_IN ]
, 5000);
"__appId",
[chrome.cast.Capability.VIDEO_OUT, chrome.cast.Capability.AUDIO_IN],
5000
);
expect(sessionRequest.appId).toBe("__appId");
expect(sessionRequest.capabilities).toEqual([ "video_out", "audio_in" ]);
expect(sessionRequest.capabilities).toEqual(["video_out", "audio_in"]);
expect(sessionRequest.requestSessionTimeout).toBe(5000);
});
});