Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion packages/eas-json/schema/eas.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,9 @@
"markdownDescription": "Path to the JSON file with service account key used to authenticate with Google Play. [Learn more](https://expo.fyi/creating-google-service-account)"
},
"track": {
"enum": ["beta", "alpha", "internal", "production"],
"type": "string",
"minLength": 1,
"maxLength": 50,
"description": "The track of the application to use. Learn more: https://support.google.com/googleplay/android-developer/answer/9859348?hl=en",
"markdownDescription": "The [track of the application](https://support.google.com/googleplay/android-developer/answer/9859348?hl=en) to use.",
"markdownEnumDescriptions": [
Expand Down
93 changes: 93 additions & 0 deletions packages/eas-json/src/__tests__/submitProfiles-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,99 @@ test('android config with serviceAccountKeyPath set to env var', async () => {
}
});

test('android config without track name', async () => {
await fs.writeJson('/project/eas.json', {
submit: {
production: {
android: {
serviceAccountKeyPath: './path.json',
releaseStatus: 'completed',
},
},
},
});

const accessor = EasJsonAccessor.fromProjectPath('/project');
const androidProfile = await EasJsonUtils.getSubmitProfileAsync(
accessor,
Platform.ANDROID,
'production'
);

expect(androidProfile).toEqual({
serviceAccountKeyPath: './path.json',
track: 'internal',
releaseStatus: 'completed',
changesNotSentForReview: false,
});
});

test('android config with non-empty string track name within 50 characters', async () => {
await fs.writeJson('/project/eas.json', {
submit: {
production: {
android: {
serviceAccountKeyPath: './path.json',
track: 'my-custom-track',
releaseStatus: 'completed',
},
},
},
});

const accessor = EasJsonAccessor.fromProjectPath('/project');
const androidProfile = await EasJsonUtils.getSubmitProfileAsync(
accessor,
Platform.ANDROID,
'production'
);

expect(androidProfile).toEqual({
serviceAccountKeyPath: './path.json',
track: 'my-custom-track',
changesNotSentForReview: false,
releaseStatus: 'completed',
});
});

test('android config with non-empty string track name over 50 characters', async () => {
await fs.writeJson('/project/eas.json', {
submit: {
production: {
android: {
serviceAccountKeyPath: './path.json',
track:
'lorem ipsum dolor sit amet consectetur adipiscing elit sed do eiusmod tempor incididunt ut labore et dolore magna aliqua',
releaseStatus: 'completed',
},
},
},
});

const accessor = EasJsonAccessor.fromProjectPath('/project');
const promise = EasJsonUtils.getSubmitProfileAsync(accessor, Platform.ANDROID, 'production');

await expect(promise).rejects.toThrow(InvalidEasJsonError);
});

test('android config with empty string track value', async () => {
await fs.writeJson('/project/eas.json', {
submit: {
production: {
android: {
serviceAccountKeyPath: './path.json',
track: '',
releaseStatus: 'completed',
},
},
},
});

const accessor = EasJsonAccessor.fromProjectPath('/project');
const promise = EasJsonUtils.getSubmitProfileAsync(accessor, Platform.ANDROID, 'production');
await expect(promise).rejects.toThrow(InvalidEasJsonError);
});

test('ios config with all required values', async () => {
await fs.writeJson('/project/eas.json', {
submit: {
Expand Down
4 changes: 1 addition & 3 deletions packages/eas-json/src/submit/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ import { AndroidReleaseStatus, AndroidReleaseTrack } from './types';

export const AndroidSubmitProfileSchema = Joi.object({
serviceAccountKeyPath: Joi.string(),
track: Joi.string()
.valid(...Object.values(AndroidReleaseTrack))
.default(AndroidReleaseTrack.internal),
track: Joi.string().min(1).max(50).default(AndroidReleaseTrack.internal),
releaseStatus: Joi.string()
.valid(...Object.values(AndroidReleaseStatus))
.default(AndroidReleaseStatus.completed),
Expand Down