-
Notifications
You must be signed in to change notification settings - Fork 61
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
Bounty Creation Unit Test #1037
Conversation
looks like gitactions checks are failing if you can fix |
Hey @Khaalid-oh thanks for this PR. It looks like some tests are failing such as prettier, craco, and jest. Can you address those? If you're not familiar with how, you can join our stand up and you cask raph/kev for help. |
Alright, I'm sure he can help with some of the questions I have. You can set that up |
Invited |
made some updates in 0293310 I think we still need to add some changes but I got started a bit but we still probably need to make some changes let me know what you think @Khaalid-oh |
Looks nice to me, what other changes do you have in mind? |
Hey so we are missing two tests from the issue:
|
Done ✅ |
All tests passed. Let's get one more code review |
frontend/app/src/config/host.ts
Outdated
@@ -3,7 +3,7 @@ const externalDockerHosts = ['localhost:23007', 'localhost:23000']; | |||
|
|||
export function getHost(): string { | |||
const host = window.location.host.includes('localhost') ? 'localhost:5002' : window.location.host; | |||
return host; | |||
return 'people.sphinx.chat'; |
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.
please change this back, this will also effect the unit tests
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.
This is also for another issue, I'll create a different PR for it
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.
not sure why there is code change for a unit test PR
frontend/app/yarn.lock
Outdated
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 shouldnt be including a new yarn.lock file
frontend/app/src/store/main.ts
Outdated
@@ -1428,6 +1428,7 @@ export class MainStore { | |||
|
|||
async deleteBounty(created: number, owner_pubkey: string): Promise<void> { | |||
const info = uiStore.meInfo as any; | |||
console.log(uiStore.meInfo); |
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.
remove console.log I think I may have added this on accident
frontend/app/src/people/widgetViews/organization/AddUserModal.tsx
Outdated
Show resolved
Hide resolved
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.
Revert this, there should be no changes on a unit test PR
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.
This is for another issue raised, I'll create a new PR for this
// jest.mock('../store/main.ts', () => ({ | ||
// get: jest.fn().mockResolvedValue([ | ||
// { | ||
// body: { | ||
// assigned_hours: 0, | ||
// assignee: '', | ||
// award: '', | ||
// bounty_expires: '', | ||
// coding_languages: ['Lightning'], | ||
// commitment_fee: 0, | ||
// created: 1702398254, | ||
// deliverables: 'test', | ||
// description: 'test', | ||
// estimated_completion_date: '', | ||
// estimated_session_length: '', | ||
// github_description: false, | ||
// id: 892, | ||
// one_sentence_summary: '', | ||
// org_uuid: 'ck13rgua5fdkhph1po4g', | ||
// owner_id: '03bfe6723c06fb2b7546df1e8ca1a17ae5c504615da32c945425ccbe8d3ca6260d', | ||
// paid: false, | ||
// paid_date: null, | ||
// price: '1', | ||
// show: true, | ||
// ticket_url: '', | ||
// title: 'test', | ||
// tribe: 'None', | ||
// type: 'freelance_job_request', | ||
// updated: '2023-12-12T16:24:14.585187Z', | ||
// wanted_type: 'Mobile development' | ||
// }, | ||
// organization: { | ||
// img: 'https://memes.sphinx.chat/public/l-_K9mJatGvz16Ixw1lPHtG9Om8QWtZtiRS_aIQme9c=', | ||
// name: 'test after jwt', | ||
// uuid: 'ck13rgua5fdkhph1po4g' | ||
// }, | ||
// person: { | ||
// created: '2021-11-15T19:09:46.356248Z', | ||
// deleted: false, | ||
// description: 'This is the real kevkevin I like to code alot', | ||
// extras: null, | ||
// github_issues: null, | ||
// id: 38, | ||
// img: 'https://memes.sphinx.chat/public/1jPjjDsrwRoBPzahpWjR8QE5DjQ726MsUSrCOjflSmo=', | ||
// last_login: 1702065128, | ||
// new_ticket_time: 0, | ||
// owner_alias: 'kevkevin', | ||
// owner_contact_key: | ||
// 'MIIBCgKCAQEAxtkwpxx8RjdVhgzx4oUYkmJQttvFzwI+lCWYgngMi/4o8OgUF9eVvW8zSY0t9A1KEY2MdEOTGjv9QiesoN7hmkgTdUqDQd1LIsU4vBtwPVWyJs0d6VEdMySN9veN68S7Fu+S20e5gygj17X8cffoEwLNDPi0dsTgojAC/uggE98zJvHmEd/Ob/W3ADQD68DQErCejvqXK2557GtsDNo35iIN9KlOPLRmvG3S/oV4pIyj5Z/6uMEXlok2b/mtvP0E4ClMP77j9QPs7mQarQ03XM0iRC2Ru/Qg/xWBTeqmYv5zfD8hmtzakBVyMSrHNZKZjSnURVNVpFaEXoB4wBqcvQIDAQAB', | ||
// owner_pubkey: '', | ||
// owner_route_hint: '', | ||
// price_to_meet: 21, | ||
// tags: [], | ||
// twitter_confirmed: true, | ||
// unique_name: 'umbreltest', | ||
// unlisted: false, | ||
// updated: '2023-12-04T19:48:05.641056Z', | ||
// uuid: 'cd9dm5ua5fdtsj2c2nbg', | ||
// wanteds: [] | ||
// } | ||
// } | ||
// ]), | ||
// })); |
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 should delete this comment
// })); | ||
|
||
const mockedApi = api as jest.Mocked<typeof api>; | ||
//const mockedUiStore = uiStore as jest.Mocked<typeof uiStore>; |
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.
delete comment
beforeEach(() => { | ||
window.localStorage.clear(); | ||
|
||
//window.localStorage.setItem('peopleBounties', JSON.stringify(mockBounties)); |
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.
delete comment
//it('should save and retrieve bounties from local storage', () => { | ||
// const storedBounties = JSON.parse(window.localStorage.getItem('peopleBounties') || '[]'); | ||
// expect(storedBounties).toEqual(mockBounties); | ||
//}, 8000); |
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.
delete comment
}); | ||
|
||
it('should save a new bounty and persist to localStorage', async () => { | ||
//mockedApi.post.mockResolvedValue({ data: newBounty }); |
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.
delete comment
//const bounties = JSON.parse(mockLocalStorage.getItem('peopleBounties')); | ||
//expect(window.localStorage.getItem('peopleBounties')).toContainEqual([]); |
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.
delete comment
const expectedBountyResponse = [ | ||
{ | ||
body: { | ||
assigned_hours: 0, | ||
assignee: '', | ||
award: '', | ||
bounty_expires: '', | ||
coding_languages: ['Lightning'], | ||
commitment_fee: 0, | ||
created: 1702398254, | ||
deliverables: 'test', | ||
description: 'test', | ||
estimated_completion_date: '', | ||
estimated_session_length: '', | ||
github_description: false, | ||
id: 892, | ||
one_sentence_summary: '', | ||
org_uuid: 'ck13rgua5fdkhph1po4g', | ||
owner_id: '03bfe6723c06fb2b7546df1e8ca1a17ae5c504615da32c945425ccbe8d3ca6260d', | ||
paid: false, | ||
paid_date: null, | ||
price: '1', | ||
show: true, | ||
ticket_url: '', | ||
title: 'test', | ||
tribe: 'None', | ||
type: 'freelance_job_request', | ||
updated: '2023-12-12T16:24:14.585187Z', | ||
wanted_type: 'Mobile development' | ||
}, | ||
organization: { | ||
img: 'https://memes.sphinx.chat/public/l-_K9mJatGvz16Ixw1lPHtG9Om8QWtZtiRS_aIQme9c=', | ||
name: 'test after jwt', | ||
uuid: 'ck13rgua5fdkhph1po4g' | ||
}, | ||
person: { | ||
created: '2021-11-15T19:09:46.356248Z', | ||
deleted: false, | ||
description: 'This is the real kevkevin I like to code alot', | ||
extras: null, | ||
github_issues: null, | ||
id: 38, | ||
img: 'https://memes.sphinx.chat/public/1jPjjDsrwRoBPzahpWjR8QE5DjQ726MsUSrCOjflSmo=', | ||
last_login: 1702065128, | ||
new_ticket_time: 0, | ||
owner_alias: 'kevkevin', | ||
owner_contact_key: | ||
'MIIBCgKCAQEAxtkwpxx8RjdVhgzx4oUYkmJQttvFzwI+lCWYgngMi/4o8OgUF9eVvW8zSY0t9A1KEY2MdEOTGjv9QiesoN7hmkgTdUqDQd1LIsU4vBtwPVWyJs0d6VEdMySN9veN68S7Fu+S20e5gygj17X8cffoEwLNDPi0dsTgojAC/uggE98zJvHmEd/Ob/W3ADQD68DQErCejvqXK2557GtsDNo35iIN9KlOPLRmvG3S/oV4pIyj5Z/6uMEXlok2b/mtvP0E4ClMP77j9QPs7mQarQ03XM0iRC2Ru/Qg/xWBTeqmYv5zfD8hmtzakBVyMSrHNZKZjSnURVNVpFaEXoB4wBqcvQIDAQAB', | ||
owner_pubkey: '', | ||
owner_route_hint: '', | ||
price_to_meet: 21, | ||
tags: [], | ||
twitter_confirmed: true, | ||
unique_name: 'umbreltest', | ||
unlisted: false, | ||
updated: '2023-12-04T19:48:05.641056Z', | ||
uuid: 'cd9dm5ua5fdtsj2c2nbg', | ||
wanteds: [] | ||
} | ||
} | ||
]; |
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 should move this into the mockBounties.data.ts
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.
why is this file modifed
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.
This is for the [glitch when moving from a tab on profile to default profile view]
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.
it should not be modified in this PR
Describe your changes
Issue ticket number and link
Closes #996
Type of change
Please delete options that are not relevant.
Checklist before requesting a review