-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Clean up 'any' typing in src/emulators #10405
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
29e557a
e45a8ba
53ab99b
55d77eb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,7 +3,7 @@ | |
| import * as fs from "fs-extra"; | ||
| import { upload, Distribution, awaitTestResults, DistributionFileType } from "./distribution"; | ||
| import { AppDistributionClient } from "./client"; | ||
| import { UploadReleaseResult, ReleaseTest } from "./types"; | ||
| import { UploadReleaseResult, ReleaseTest, Release, TestDevice } from "./types"; | ||
| import * as utils from "../utils"; | ||
|
|
||
| describe("appdistribution/distribution", () => { | ||
|
|
@@ -68,7 +68,11 @@ | |
| mockClient.uploadRelease.resolves("operations/123"); | ||
| mockClient.pollUploadStatus.resolves({ | ||
| result: UploadReleaseResult.RELEASE_CREATED, | ||
| release: { displayVersion: "1.0", buildVersion: "1", name: "test-rel" } as unknown as any, | ||
| release: { | ||
| displayVersion: "1.0", | ||
| buildVersion: "1", | ||
| name: "test-rel", | ||
| } as unknown as Release, | ||
| }); | ||
|
|
||
| const res = await upload( | ||
|
|
@@ -94,34 +98,40 @@ | |
|
|
||
| describe("awaitTestResults", () => { | ||
| it("should succeed when all tests pass on first poll", async () => { | ||
| const releaseTests: ReleaseTest[] = [{ name: "tests/1", deviceExecutions: [] } as any]; | ||
| const releaseTests: ReleaseTest[] = [{ name: "tests/1", deviceExecutions: [] }]; | ||
| mockClient.getReleaseTest.resolves({ | ||
| name: "tests/1", | ||
| deviceExecutions: [{ state: "PASSED", device: { model: "Pixel" } as unknown as any }], | ||
| deviceExecutions: [ | ||
| { state: "PASSED", device: { model: "Pixel" } as unknown as TestDevice }, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: no need unknown here |
||
| ], | ||
| } as unknown as ReleaseTest); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: no need unknown here |
||
|
|
||
| const setTimeoutStub = sinon.stub(global, "setTimeout").callsFake((fn) => fn() as any); | ||
|
Check warning on line 109 in src/appdistribution/distribution.spec.ts
|
||
|
|
||
| await awaitTestResults(releaseTests, mockClient as any); | ||
|
Check warning on line 111 in src/appdistribution/distribution.spec.ts
|
||
|
|
||
| expect(logSuccessStub).to.have.been.calledWithMatch(/Automated test\(s\) passed/); | ||
| setTimeoutStub.restore(); | ||
| }); | ||
|
|
||
| it("should fail immediately when a test execution fails", async () => { | ||
| const releaseTests: ReleaseTest[] = [{ name: "tests/1", deviceExecutions: [] } as any]; | ||
| const releaseTests: ReleaseTest[] = [{ name: "tests/1", deviceExecutions: [] }]; | ||
| mockClient.getReleaseTest.resolves({ | ||
| name: "tests/1", | ||
| deviceExecutions: [ | ||
| { state: "FAILED", failedReason: "Crash", device: { model: "Pixel" } as any }, | ||
| { | ||
| state: "FAILED", | ||
| failedReason: "Crash", | ||
| device: { model: "Pixel" } as unknown as TestDevice, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. unknown |
||
| }, | ||
| ], | ||
| } as any); | ||
|
|
||
| const setTimeoutStub = sinon.stub(global, "setTimeout").callsFake((fn) => fn() as any); | ||
|
Check warning on line 130 in src/appdistribution/distribution.spec.ts
|
||
|
|
||
| let caughtError: any; | ||
| try { | ||
| await awaitTestResults(releaseTests, mockClient as any); | ||
| } catch (err) { | ||
| caughtError = err; | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: no need unknown here