Closed blombard closed 1 year ago
Thanks for the issue and the pull request!
Could you share a code snippet that I can use to test your changes? We should update the tests to cover your changes. But it might be tricky for iteration fields as they change based on date ... 🤔
I found an open-source project so you could test easily: https://github.com/orgs/carbon-design-system/projects/39/views/12 But it would be easier if this repo had a project I guess.
import GitHubProject from "github-project";
const project = new GitHubProject({
owner: "carbon-design-system",
number: 39,
token: "ghp_qDGF...",
fields: {
Sprint: "Sprint", // Sprint is the iteration name in this case
},
});
const item = await project.items.get('PVTI_lADOAYA3Ss1Nv84AOX-b');
console.log(item);
const updatedItem = await project.items.update('id', { Sprint: 'Sprint 42'}); // Sprint is the iteration name in this case
console.log(updatedItem);
The first console.log
would return:
{
type: 'ISSUE',
id: 'PVTI_lADOAYA3Ss1Nv84AOX-b',
fields: {
title: '[a11y]: focus not visible when clicking on combobox toggle',
status: '✅ Done',
Sprint: undefined
},
content: {
...
}
}
And now
{
type: 'ISSUE',
id: 'PVTI_lADOAYA3Ss1Nv84AOX-b',
fields: {
title: '[a11y]: focus not visible when clicking on combobox toggle',
status: '✅ Done',
Sprint: 'Sprint 53'
},
content: {
...
}
}
But it would be easier if this repo had a project I guess.
https://github.com/orgs/github-project-fixtures/projects, I can invite you to it so you can create a test project there or amend the existing one, and record fixtures for #95 as described here: https://github.com/gr2m/github-project/blob/main/CONTRIBUTING.md#recording-fixtures-for-testing. Would that work?
Yes you can invite me and I'll try to follow the instructions 😅
Invitation is out. Here are the credentials you'll need for the automation to work: https://github.com/orgs/github-project-fixtures/teams/contributors/discussions/1
I recorded fixtures for #95 and everything works. Code coverage is still 100%.
I added the iteration
field to:
api.items.add-with-custom-fields
api.items.get
api.items.list
api.items.remove
api.items.update
And created:
api.items.update-iteration
Should I take the time to add the iteration
field to all tests when possible or is that enough?
Please avoid duplicates
What’s missing?
The iteration field is a special field not handled for now by this package.
Why?
For now when I do
project.items.get
theiteration
field is alwaysundefined
. And when I try to doproject.items.update
with an iteration field, I always get an error.Alternatives you tried
/
Would you be interested in contributing the feature?