-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
fix: implement new graphql fields for spec counts #25757
Merged
+290
−37
Merged
Changes from all commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
df76d1c
add new fixture
marktnoonan 06ca95e
update comment
marktnoonan 55abda9
add unit test based on current functionality
marktnoonan 97d560a
add second test case based on current logic
marktnoonan cd88393
update test
marktnoonan 5ae892f
[run ci] switch to new fields
marktnoonan 89cbf00
run ci
marktnoonan 75c030f
accept runNumber arg in relevantRunSpecChange
marktnoonan 174e5f1
formatting
marktnoonan e502f21
revert runNumber arg
marktnoonan 97131cf
commit updated graphql files
marktnoonan 6ec7f87
update conditional logic and test
marktnoonan c13a6b3
[run ci] only invalidate cache when watching `current`
marktnoonan 4b3a56b
Merge branch 'develop' into marktnoonan/25647-new-cloud-fields
marktnoonan 945a66f
commit updated schema
marktnoonan 0e72f2e
[run ci] - fix build time type error
marktnoonan 9d520fb
Merge branch 'develop' into marktnoonan/25647-new-cloud-fields
marktnoonan 0a727c3
fix types in stubs
marktnoonan 0f2712e
add new properties to query
marktnoonan 6f53db7
test cleanup
marktnoonan 94a33c3
Merge branch 'develop' into marktnoonan/25647-new-cloud-fields
marktnoonan b4a1a0f
fix condition for cache clearing
marktnoonan e7a4059
Merge branch 'marktnoonan/25647-new-cloud-fields' of https://github.c…
marktnoonan 83a95b9
update changelog
marktnoonan 762dc2d
update changelog
marktnoonan 97b2b43
Update packages/data-context/test/unit/sources/RelevantRunSpecsDataSo…
marktnoonan ae96ae7
Update cli/CHANGELOG.md
marktnoonan 8c1e747
updates from feedback
marktnoonan f138cc3
make helper for repeated code
marktnoonan e6c08fa
Merge branch 'develop' into marktnoonan/25647-new-cloud-fields
marktnoonan 46e79a5
remove bang
marktnoonan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
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
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
68 changes: 68 additions & 0 deletions
68
packages/data-context/test/unit/sources/RelevantRunSpecsDataSource.spec.ts
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,68 @@ | ||
import { expect } from 'chai' | ||
import sinon from 'sinon' | ||
|
||
import { DataContext } from '../../../src' | ||
import { createTestDataContext } from '../helper' | ||
import { RelevantRunSpecsDataSource, SPECS_EMPTY_RETURN } from '../../../src/sources' | ||
import { FAKE_PROJECT_ONE_RUNNING_RUN_ONE_COMPLETED_THREE_SPECS, FAKE_PROJECT_ONE_RUNNING_RUN_ONE_SPEC } from './fixtures/graphqlFixtures' | ||
|
||
describe('RelevantRunSpecsDataSource', () => { | ||
let ctx: DataContext | ||
let dataSource: RelevantRunSpecsDataSource | ||
|
||
beforeEach(() => { | ||
ctx = createTestDataContext('open') | ||
dataSource = new RelevantRunSpecsDataSource(ctx) | ||
sinon.stub(ctx.project, 'projectId').resolves('test123') | ||
}) | ||
|
||
describe('getRelevantRunSpecs()', () => { | ||
it('returns no specs or statuses when no specs found for run', async () => { | ||
const result = await dataSource.getRelevantRunSpecs({ current: 11111, next: 22222, commitsAhead: 0 }) | ||
|
||
expect(result).to.eql(SPECS_EMPTY_RETURN) | ||
}) | ||
|
||
it('returns expected specs and statuses when one run is found', async () => { | ||
sinon.stub(ctx.cloud, 'executeRemoteGraphQL').resolves(FAKE_PROJECT_ONE_RUNNING_RUN_ONE_SPEC) | ||
|
||
const result = await dataSource.getRelevantRunSpecs({ current: 1, next: null, commitsAhead: 0 }) | ||
|
||
expect(result).to.eql({ | ||
runSpecs: { | ||
current: { | ||
runNumber: 1, | ||
completedSpecs: 1, | ||
totalSpecs: 1, | ||
}, | ||
}, | ||
statuses: { current: 'RUNNING' }, | ||
}) | ||
}) | ||
|
||
it('returns expected specs and statuses when one run is completed and one is running', async () => { | ||
sinon.stub(ctx.cloud, 'executeRemoteGraphQL').resolves(FAKE_PROJECT_ONE_RUNNING_RUN_ONE_COMPLETED_THREE_SPECS) | ||
|
||
const result = await dataSource.getRelevantRunSpecs({ current: 1, next: null, commitsAhead: 0 }) | ||
|
||
expect(result).to.eql({ | ||
runSpecs: { | ||
current: { | ||
runNumber: 1, | ||
completedSpecs: 3, | ||
totalSpecs: 3, | ||
}, | ||
next: { | ||
runNumber: 2, | ||
completedSpecs: 0, | ||
totalSpecs: 3, | ||
}, | ||
}, | ||
statuses: { | ||
current: 'PASSED', | ||
next: 'RUNNING', | ||
}, | ||
}) | ||
}) | ||
}) | ||
}) |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Instead of modifying this on the fly, should we use the fixtures you added such as
FAKE_PROJECT_MULTIPLE_COMPLETED
?I find the modified on the fly ones kind of hard to read - you need to have a mental modal of exactly what you are modifying in the first place. How about you?