Skip to content
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

Bi 46 review 1 #25

Merged
merged 22 commits into from
Feb 8, 2024
Merged

Bi 46 review 1 #25

merged 22 commits into from
Feb 8, 2024

Conversation

meenalnimje
Copy link
Contributor

new pr for BI-46

Copy link

codecov bot commented Feb 3, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (0ae929f) 93.10% compared to head (7ffaf79) 100.00%.

Additional details and impacted files
@@             Coverage Diff             @@
##            BI-46       #25      +/-   ##
===========================================
+ Coverage   93.10%   100.00%   +6.89%     
===========================================
  Files           4         3       -1     
  Lines          29        26       -3     
  Branches        3         4       +1     
===========================================
- Hits           27        26       -1     
+ Misses          2         0       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -14,48 +16,48 @@ const query = gql`
}
}
`

let uri = 'https://web-app-client-b69l4yjrq-bacpacs-projects.vercel.app/api/graphql'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a comment such that:

// TODO: Figure out a way to _not_ use a deployed vercel instance for GraphQL

const client = new ApolloClient({
link: new HttpLink({ uri, fetch }),
cache: new InMemoryCache(),
})
async function fetchData() {
try {
const result = await client.query({ query })
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of using a try-catch, we can use this statement directly inside the tests. If we do that, then the tests will fail, if the fetching fails.

} catch (e) {
expect(e.message).toMatch('error')
}
const result = await fetchData()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here...

} catch (e) {
expect(e.message).toMatch('error')
}
const result = await fetchData()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here...

describe('searchAlgorithm', () => {
it('returns filtered results when input and data are provided', () => {
const input = 'mass'
const colleges = [{ name: 'Massachusetts Institute of Technology (MIT)', country: 'United States', city: 'Cambridge' }]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's reuse the colleges in all these three tests. So, let's initialize it inside the describe.

})
it('returns an empty array when either input is not provided', () => {
const input = ''
const resultWithoutData = searchAlgorithm(input, null)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's separate the setup lines, act and assertions by adding blank lines below and above the act.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You might want to rename the variable resultWithoutData to result, once you decide to use the colleges variable as data.

@@ -14,48 +16,48 @@ const query = gql`
}
}
`

let uri = 'https://web-app-client-b69l4yjrq-bacpacs-projects.vercel.app/api/graphql'
console.log('graphql_uri', uri)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can use the console log as:

console.log("GraphQL URI in tests:", uri)

src/client.js Outdated
// default:
// break
// }
console.log('graphql_uri', uri)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can use the console log as:

console.log("GraphQL URI in Client:", uri)

Remove the commented out lines.

// query getUniversityName($id: ID!) {
// university_name(id: $id)
// }
// `
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can remove these commented out lines.

Copy link
Collaborator

@bacpactech bacpactech left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well done! 👍

@bacpactech bacpactech merged commit 0c7e04f into BI-46 Feb 8, 2024
6 checks passed
bacpactech pushed a commit that referenced this pull request Feb 8, 2024
* search-bar feature added

* suggested changes added

* 2nd review

* merge commit fix

* prettier formate

* changes in stories

* export removed

* suggested changes made

* storybook for navbar and footer is added

* footer position changed from sticky to relative

* css changes in footer

* change in css of footer

* change-1:-spacing,footer title resolved and font style corrected

* design changed in navbar acc. to design team

* navbarlinks colour changed to black

* error resolved

* homepage storybook added

* changes based on chromatic comments

* size of navbar and footer decresed

* alignment correction

* another text alignment correction

* navbar alignment changes

* navbar logo size fixed

* searchbar element visibility corrected && other elemnts of searchpage added

* design and responsiveness added

* color added in specific texts

* after review suggested changes made

* fetching data from mongodb query added

* change for BI-28

* query for fetching data from mongo is added, testing is left

* error in workflow checks and tests resolved

* storybook error solved

* error in workflow resolved

* workflow error is resolved

* testing code for fetching college data is added

* fixes to solve workflow error

* testing code fixed

* some error fixed

* Bi 46 review 1 (#25)

* changes made after review-1

* test error fixed

* fixing testing error

* fixing error in testing

* fixing error of testing

* fixing errors in testing query url

* adding manual url

* prev code to fix the error

* deployed link added

* Deployed link is added

* vercal bot link added for test

* after 2nd code review

* switch statement is added for diffrent enviorments

* absolute url in testing added

* solving bi-46 issues

* testing for apis

* new link added

* cors added

* resolving error

* test error resolved

* prettier format checked

* changes after 2nd review done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants