-
-
Notifications
You must be signed in to change notification settings - Fork 740
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
feat: map project owners to projects list #6928
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Ignored Deployment
|
describe('unit tests', () => { | ||
test('maps owners to projects', () => {}); | ||
test('maps owners to projects', () => { | ||
const projects = [{ name: 'project1' }, { name: 'project2' }] as any; | ||
|
||
const owners = { | ||
project1: [{ ownerType: 'user' as const, name: 'Owner Name' }], | ||
project2: [{ ownerType: 'user' as const, name: 'Owner Name' }], | ||
}; | ||
|
||
const projectsWithOwners = ProjectOwnersReadModel.addOwnerData( | ||
projects, | ||
owners, | ||
); | ||
|
||
expect(projectsWithOwners).toMatchObject([ | ||
{ name: 'project1', owners: [{ name: 'Owner Name' }] }, | ||
{ name: 'project2', owners: [{ name: 'Owner Name' }] }, | ||
]); | ||
}); | ||
|
||
test('returns "system" when a project has no owners', async () => { | ||
// this is a mapping test; not an integration test | ||
const projects = [{ name: 'project1' }, { name: 'project2' }] as any; | ||
|
||
const owners = {}; | ||
|
||
const projectsWithOwners = ProjectOwnersReadModel.addOwnerData( | ||
projects, | ||
owners, | ||
); | ||
|
||
expect(projectsWithOwners).toMatchObject([ | ||
{ name: 'project1', owners: [{ ownerType: 'system' }] }, | ||
{ name: 'project2', owners: [{ ownerType: 'system' }] }, | ||
]); | ||
}); | ||
}); |
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.
Can be done later, but I think we should put the unit tests in a separate file? So we'll probably have project-owners-read-model.test.ts
and project-owners-read-model.integration.test.ts
. Feels like it jives better with what we're doing most the time.
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.
We have 3 types that correlate better to methods under test then to any specific test type. I think we can just describe what part of the class we are testing instead of moving it to a separate file
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.
Fair enough 💁🏼
About the changes
Follow-up for #6916
Internal ticket: https://linear.app/unleash/issue/1-2320/project-owners-mapping