-
-
Notifications
You must be signed in to change notification settings - Fork 55
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
initial attempt to fix title > 255 char #1189
Conversation
I took a quick took, turns out I don't have unit tests for the patch endpoint already, but I do have one for the create endpoint here:
since you can include a title when creating a room too, you'll need to check the title in there too |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1189 +/- ##
================================================
+ Coverage 61.4426% 61.6270% +0.1843%
================================================
Files 115 115
Lines 9316 9379 +63
Branches 1139 1141 +2
================================================
+ Hits 5724 5780 +56
- Misses 3592 3599 +7 ☔ View full report in Codecov by Sentry. |
Currently the change I made kind of works on my local copy? When I try to edit the title to be > 255 chars a 401 response is sent, but when you try to make any edits afterwards nothing works and the room settings cannot be loaded. What are the differences between createRoom & generateRoom? In createRoom the title property does not exist. Also, if I use the same code I used for the patch request I get an error where the field is not recognized as a property. I figured I would need to mess with createRoom, but that seems to not be the case. |
Yes, Making a HTTP request: Looks like you'll need to add
I'll try it on my machine. |
Make sure all the required CI is passing before you mark it as ready to review. |
Got it. |
I did run yarn test & yarn lint, as well as turning on format on save. I'm not sure why the tests are failing, however. The changes I made seem to be working though. |
CI says tests pass, but there's formatting errors. You can click details on the failing job to see the logs. But tbh |
It gives me 16 warnings, 0 errors. It's giving me those warnings in files I haven't touched at all yet though. Any idea why? Also, two things. I see that rust build failed to run and that is required to merge. Not sure why. Additionally, when I run the test suite some test suites fail to run. Jest says it's finding 6 handles keeping it from exiting. |
The rust tests are a bit flaky right now, so don't worry about it. The jest open handle thing is normal, it doesn't affect the test results. |
Stupid mistake. Was on the wrong branch. Should hopefully be good now. |
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.
Diff looks good. Do you want to add unit tests for this? Totally optional, I'll add them if you don't.
I want to try and give it a shot. |
Added the unit test for the create endpoint. Ran yarn lint & test. Not sure if yarn lint did anything though. Besides that, a few questions. In room.spec.ts where you describe the tests for the create endpoint, what do getSessionInfoSpy and validateSpy do? What purpose do the tokens serve, are they a type of identifier? If I am creating unit tests for the other endpoint, would I need to declare the app variable again and include the beforeAll, afterAll and afterEach again? Also, in common/models are those files similar to mongoose schemas? Basically, are they how the database tables are set up? |
Inside the describe("POST /api/room/:name", () => {
beforeAll(() => {
// create a temporary room to test against
});
afterAll(() => {
// unload all rooms
});
it.each([
[expectedError, requestBody],
])("should fail to modify room for validation errors: %s", async (error, body) => {
// test code here
});
}); No need to add a bunch of cases to get full coverage of the endpoint, just write enough to cover the changes in this PR. The stuff in |
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.
Looks good. just a minor thing
* initial attempt to fix title > 255 char * added title to OttApiRequestRoomCreate * add validator to createRoom & throw proper error * ran yarn lint * add title test for create endpoint * fixed unit test for create endpoint, added unit test for patch endpoint * fixed stray import * fixed post endpoint unit test * one more fix * added authorization to request * ran yarn lint
closes #312