-
Notifications
You must be signed in to change notification settings - Fork 88
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
[eas-cli] [ENG-10146] Allow submission of builds in progress #2543
Changes from 5 commits
699f138
913bb2f
ae0edda
ffd35b9
99e8dc3
cec4a1d
41ccaf7
b3d1bfe
5faff60
f965739
7f546c7
ace04b7
45b91ac
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 |
---|---|---|
@@ -0,0 +1,110 @@ | ||
import { getRecentBuildsForSubmissionAsync } from '../builds'; | ||
Check warning on line 1 in packages/eas-cli/src/submit/utils/__tests__/builds-test.ts GitHub Actions / Test with Node 22
|
||
import { v4 as uuidv4 } from 'uuid'; | ||
import { AppPlatform, BuildFragment, BuildStatus, SubmissionArchiveSourceType } from '../../../graphql/generated'; | ||
Check warning on line 3 in packages/eas-cli/src/submit/utils/__tests__/builds-test.ts GitHub Actions / Test with Node 22
Check warning on line 3 in packages/eas-cli/src/submit/utils/__tests__/builds-test.ts GitHub Actions / Test with Node 22
|
||
import { BuildQuery } from "../../../graphql/queries/BuildQuery"; | ||
Check warning on line 4 in packages/eas-cli/src/submit/utils/__tests__/builds-test.ts GitHub Actions / Test with Node 22
|
||
import { ExpoGraphqlClient } from "../../../commandUtils/context/contextUtils/createGraphqlClient"; | ||
|
||
jest.mock('../../../graphql/queries/BuildQuery', () => ({ | ||
BuildQuery: { | ||
viewBuildsOnAppAsync: jest.fn(), | ||
}, | ||
})); | ||
|
||
const ARCHIVE_SOURCE = { | ||
type: SubmissionArchiveSourceType.Url, | ||
url: 'https://url.to/archive.tar.gz', | ||
}; | ||
|
||
const MOCK_BUILD_FRAGMENTS: Partial<BuildFragment>[] = Array(5).map(() => ({ | ||
id: uuidv4(), | ||
artifacts: { | ||
buildUrl: ARCHIVE_SOURCE.url, | ||
}, | ||
appVersion: '1.2.3', | ||
platform: AppPlatform.Android, | ||
updatedAt: Date.now(), | ||
status: BuildStatus.Finished, | ||
})); | ||
const MOCK_IN_PROGRESS_BUILD_FRAGMENTS: Partial<BuildFragment>[] = Array(5).map(() => ({ | ||
id: uuidv4(), | ||
artifacts: { | ||
buildUrl: ARCHIVE_SOURCE.url, | ||
}, | ||
appVersion: '1.2.3', | ||
platform: AppPlatform.Android, | ||
updatedAt: Date.now(), | ||
status: BuildStatus.InProgress, | ||
})); | ||
|
||
describe(getRecentBuildsForSubmissionAsync, () => { | ||
let graphqlClient: ExpoGraphqlClient; | ||
|
||
beforeEach(() => { | ||
graphqlClient = {} as any as ExpoGraphqlClient; | ||
}); | ||
|
||
it('returns finished builds if there are no in-progress builds', async () => { | ||
const appId = uuidv4(); | ||
const limit = 2; | ||
jest.mocked(BuildQuery.viewBuildsOnAppAsync) | ||
.mockResolvedValueOnce([] as BuildFragment[]) | ||
.mockResolvedValueOnce(MOCK_BUILD_FRAGMENTS.slice(0, limit) as BuildFragment[]); | ||
|
||
const result = await getRecentBuildsForSubmissionAsync( | ||
graphqlClient, | ||
AppPlatform.Android, | ||
appId, | ||
{ limit }, | ||
) | ||
|
||
expect(result).toMatchObject(MOCK_BUILD_FRAGMENTS.slice(0, limit)); | ||
}); | ||
it('returns in-progress builds if there are no finished builds', async () => { | ||
const appId = uuidv4(); | ||
const limit = 2; | ||
jest.mocked(BuildQuery.viewBuildsOnAppAsync) | ||
.mockResolvedValueOnce(MOCK_IN_PROGRESS_BUILD_FRAGMENTS.slice(0, limit) as BuildFragment[]) | ||
.mockResolvedValueOnce([] as BuildFragment[]); | ||
|
||
const result = await getRecentBuildsForSubmissionAsync( | ||
graphqlClient, | ||
AppPlatform.Android, | ||
appId, | ||
{ limit }, | ||
) | ||
|
||
expect(result).toMatchObject(MOCK_IN_PROGRESS_BUILD_FRAGMENTS.slice(0, limit)); | ||
}); | ||
it('returns in-progress builds if there are finished builds, but in-progress ones fill the limit', async () => { | ||
const appId = uuidv4(); | ||
const limit = 2; | ||
jest.mocked(BuildQuery.viewBuildsOnAppAsync) | ||
.mockResolvedValueOnce(MOCK_IN_PROGRESS_BUILD_FRAGMENTS.slice(0, limit) as BuildFragment[]) | ||
.mockResolvedValueOnce(MOCK_BUILD_FRAGMENTS.slice(0, limit) as BuildFragment[]); | ||
|
||
const result = await getRecentBuildsForSubmissionAsync( | ||
graphqlClient, | ||
AppPlatform.Android, | ||
appId, | ||
{ limit }, | ||
) | ||
|
||
expect(result).toMatchObject(MOCK_IN_PROGRESS_BUILD_FRAGMENTS.slice(0, limit)); | ||
}); | ||
it('returns in-progress and finished builds if in-progress ones don\'t fill the limit', async () => { | ||
const appId = uuidv4(); | ||
const limit = 4; | ||
jest.mocked(BuildQuery.viewBuildsOnAppAsync) | ||
.mockResolvedValueOnce(MOCK_IN_PROGRESS_BUILD_FRAGMENTS.slice(0, 2) as BuildFragment[]) | ||
.mockResolvedValueOnce(MOCK_BUILD_FRAGMENTS.slice(0, 2) as BuildFragment[]); | ||
|
||
const result = await getRecentBuildsForSubmissionAsync( | ||
graphqlClient, | ||
AppPlatform.Android, | ||
appId, | ||
{ limit }, | ||
) | ||
|
||
expect(result).toMatchObject(MOCK_IN_PROGRESS_BUILD_FRAGMENTS.slice(0, 2).concat(MOCK_BUILD_FRAGMENTS.slice(0, 2))); | ||
}); | ||
}); |
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.
What about
NEW
andIN_QUEUE
builds? I believe we should handle submitting these as well.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.
I don't see why not, I'll add them