forked from r0adkll/upload-google-play
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Set up full input testing (r0adkll#150)
* Extract main loop to something testable * Revert "Extract main loop to something testable" This reverts commit 35a7845. * Extract code that interacts with Google Play We can now test our input flow as a whole * Create some basic tests for `completed` status publishing * Fix applying inputs We don't want to be keeping values between runs * Drop some redundant tests * Create basic tests for draft rollout * Run build * Fix userFraction bug * Improve readability of initialising inputs * Fix runUpload mocking * Migrate to github-action-ts-run-api
- Loading branch information
Showing
7 changed files
with
901 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
import {RunOptions, RunTarget} from 'github-action-ts-run-api'; | ||
|
||
const target = RunTarget.mainJs('action.yml'); | ||
|
||
async function expectRunInitiatesUpload(options: RunOptions) { | ||
const result = await target.run(options) | ||
expect(result.commands.errors.length).toBe(1) | ||
expect(result.commands.errors).toContainEqual("The incoming JSON object does not contain a client_email field") | ||
} | ||
|
||
test("correct inputs for complete rollout", async () => { | ||
// Run with the bare minimum | ||
const minimumOptions = RunOptions.create() | ||
.setInputs({ | ||
serviceAccountJsonPlainText: "{}", | ||
packageName: "com.package.name", | ||
releaseFiles: "./__tests__/releasefiles/*.aab", | ||
track: "production", | ||
status: "completed", | ||
}) | ||
await expectRunInitiatesUpload(minimumOptions) | ||
|
||
// Test with optional extras | ||
const extraOptions = RunOptions.create() | ||
.setInputs({ | ||
serviceAccountJsonPlainText: "{}", | ||
packageName: "com.package.name", | ||
releaseFiles: "./__tests__/releasefiles/*.aab", | ||
releaseName: "Release name", | ||
track: "production", | ||
inAppUpdatePriority: "3", | ||
status: "completed", | ||
whatsNewDir: "./__tests__/whatsnew", | ||
changesNotSentForReview: "true", | ||
existingEditId: "123" | ||
}) | ||
await expectRunInitiatesUpload(extraOptions) | ||
}) | ||
|
||
test("correct inputs for inProgress rollout", async () => { | ||
// Run with the bare minimum | ||
const minimumOptions = RunOptions.create() | ||
.setInputs({ | ||
serviceAccountJsonPlainText: "{}", | ||
packageName: "com.package.name", | ||
releaseFiles: "./__tests__/releasefiles/*.aab", | ||
track: "production", | ||
userFraction: "0.99", | ||
status: "inProgress", | ||
}) | ||
await expectRunInitiatesUpload(minimumOptions) | ||
|
||
// Test with optional extras | ||
const extraOptions = RunOptions.create() | ||
.setInputs({ | ||
serviceAccountJsonPlainText: "{}", | ||
packageName: "com.package.name", | ||
releaseFiles: "./__tests__/releasefiles/*.aab", | ||
releaseName: "Release name", | ||
track: "production", | ||
inAppUpdatePriority: "3", | ||
userFraction: "0.5", | ||
status: "inProgress", | ||
whatsNewDir: "./__tests__/whatsnew", | ||
changesNotSentForReview: "true", | ||
existingEditId: "123" | ||
}) | ||
await expectRunInitiatesUpload(extraOptions) | ||
}) | ||
|
||
test("correct inputs for draft rollout", async () => { | ||
// Run with the bare minimum | ||
const minimumOptions = RunOptions.create() | ||
.setInputs({ | ||
serviceAccountJsonPlainText: "{}", | ||
packageName: "com.package.name", | ||
releaseFiles: "./__tests__/releasefiles/*.aab", | ||
track: "production", | ||
status: "draft", | ||
}) | ||
await expectRunInitiatesUpload(minimumOptions) | ||
|
||
// Test with optional extras | ||
const extraOptions = RunOptions.create() | ||
.setInputs({ | ||
serviceAccountJsonPlainText: "{}", | ||
packageName: "com.package.name", | ||
releaseFiles: "./__tests__/releasefiles/*.aab", | ||
releaseName: "Release name", | ||
track: "production", | ||
inAppUpdatePriority: "3", | ||
status: "draft", | ||
whatsNewDir: "./__tests__/whatsnew", | ||
changesNotSentForReview: "true", | ||
existingEditId: "123" | ||
}) | ||
await expectRunInitiatesUpload(extraOptions) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.