Philip Molares
17493a9007
MediaE2E: Fix typo in comments
...
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-03-31 22:43:13 +02:00
Philip Molares
be78b9a03d
E2ETests: Use recursive for 'uploads/' deletion.
...
This ensures the folder is always deleted, even if there are still files (from previous broken tests) in it.
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-03-31 22:42:56 +02:00
Philip Molares
9b54733ed3
MediaE2E: Extract 'uploads' deletion
...
The deletion of upload was moved to beforeEach and afterEach block in the 'POST /media' > 'fails' tests.
The test if the folder was not created, because there was no file uploaded, now correctly expects the behaviour.
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-03-31 22:41:38 +02:00
Philip Molares
4c02327546
MediaE2E: Add app.close() to afterAll
...
This terminates the app after all test have finished.
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-03-31 22:36:14 +02:00
Philip Molares
e516612a73
PrivateE2EMedia: Add E2E test for private api /media routes
...
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-03-23 22:41:57 +01:00
Philip Molares
4a44f564a7
PrivateE2E: Add test fixtures for private api
...
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-03-24 11:14:48 +01:00
Philip Molares
25e310b7eb
PublicE2EMedia: Port the extra test from the private api
...
This ports the extra tests in the POST /media test from the private apis to the public apis E2E tests.
Also the whole test suit was renamed to 'Media'.
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-03-24 11:24:39 +01:00
Philip Molares
6943399dcf
PrivateE2ENotes: Add E2E test for private api /notes routes
...
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-03-24 01:49:43 +01:00
Philip Molares
9874426c9a
PublicE2E: Remove uploaded files after test
...
This way the tests can run in any order as some of the media tests rely on an empty (or non-existing) uploads directory.
Also the me e2e test was renamed to the correct name.
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-03-24 11:18:26 +01:00
Philip Molares
e3f1d1b0f4
Config: Create new config mocks for tests
...
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-03-01 21:12:48 +01:00
Philip Molares
c1a9eee6a4
Config: Move config mocks in own folder
...
To clean up the config folder, all mocks are now in it's own folder.
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-03-01 21:12:01 +01:00
Philip Molares
4aca8ada4c
NotesE2ETest: Add GET /api/v2/notes/{note}/media test
...
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-03-19 16:54:24 +01:00
Philip Molares
53f5093630
Docs: Add more documentation to the public api
...
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-03-19 12:10:46 +01:00
Philip Molares
3594d904f7
PrivateE2E: Add history test
...
Test the /me/history route in the private API.
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-03-04 10:20:58 +01:00
Yannick Bungers
f47d85b301
Add GET /me/media
...
Returns all media files uploaded by the authenticated user.
Signed-off-by: Yannick Bungers <git@innay.de>
2021-03-14 17:47:16 +01:00
Philip Molares
50d950c5f2
PublicE2E: Add test for GET /me/history/{note} in me.e2e-spec.ts
...
add test for GET /me/history/{note}
add error cases to PUT /me/history/{note} and DELETE /me/history/{note}
activate missing test GET /me/notes/
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-03-05 12:04:06 +01:00
Philip Molares
66e2340009
NotesService: Add e2e tests for forbidden note alias
...
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-02-20 22:24:17 +01:00
Philip Molares
966f5ee2fe
Config: Add forbiddenNoteIds to AppConfig
...
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-02-20 22:15:04 +01:00
David Mehren
f20c2f06e0
Fix various ESLint errors in E2E tests
...
Signed-off-by: David Mehren <git@herrmehren.de>
2021-02-24 21:14:16 +01:00
Yannick Bungers
8b75867664
Rename getNoteContentByNote to getNoteContent
...
Signed-off-by: Yannick Bungers <git@innay.de>
2021-02-22 22:34:18 +01:00
Philip Molares
4d89ffd474
NotesService: Replace noteByIdOrAlias with note as parameter
...
As the NotesController has the note already, because it checked with it if the user has the permission to perform the action, it's not necessary to get the note from the DB again, instead we should just provide the note to the functions directly.
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-02-20 16:50:11 +01:00
Philip Molares
13955aebe5
NotesE2ETests: Ensure posting the same note alias twice fails
...
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-02-20 16:10:30 +01:00
Philip Molares
aa97a87316
NotesService: Rename getCurrentContent to getNoteContentByNote
...
The new name should better explain what this functions does.
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-02-19 13:36:01 +01:00
Philip Molares
bb04da46be
NotesE2E: Fix e2e test
...
split success and fail cases in separate tests for better readability
add the correct user to all notes created by service (instead of api) to make the permissions checks viable.
extracted test content of notes to a global variable.
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-02-17 13:20:54 +01:00
Philip Molares
0366cb491f
Media E2E Tests: Delete uploaded files after test
...
Remove uploaded files after media e2e tests ran
Remove /uploads/ folder after all media e2e tests ran
This way the uploads folder doesn't grow while working on other e2e tests
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-02-13 22:58:44 +01:00
Philip Molares
3ebea8ed77
MediaService: Add unit tests
...
The file test.zip is used to fail the saveFile test with 'MIME Type not supported'
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-02-13 22:12:19 +01:00
Philip Molares
5edf5f1676
Tests: Fix GET /me e2e test
...
Since the /me route does work now, we should reactivate (and fix) this test, too.
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-02-03 16:20:27 +01:00
Philip Molares
744a55181e
Tests: Rename users.e2e-spec.ts to me.e2e-spec.ts
...
As users.e2e-spec.ts tests the MeController this commit renames the test appropriately
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-02-03 21:51:30 +01:00
Philip Molares
36f041f0e0
History: Add unit and e2e test
...
Add unit tests for history service
Adapt relevant me e2e tests to work
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-02-03 21:46:36 +01:00
Philip Molares
e55e62c2cd
History: Add history service and usage
...
Add history service to allow for CRUD operations.
Use history service in controllers to:
1. Allow manipulating of history entries
2. Guaranty the correct existence of history entries
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-02-03 21:22:55 +01:00
Philip Molares
5920a1c72f
tests: Fix tests as part of the DTO Refactor
...
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-01-30 12:47:31 +01:00
Philip Molares
508ad26771
auth: Add tests for AuthService
...
Move AuthTokens to auth folder
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-01-22 15:29:10 +01:00
Philip Molares
cce1626c48
auth: fixes unit and e2e tests
...
adds MockAuthGuard which always return user 'hardcoded'
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-01-16 19:33:09 +01:00
Philip Molares
4372106ef0
tests: Removed unnecessary import of appConfigMock
...
As suggested by an review of David Mehren
Co-authored by: David Mehren <git@herrmehren.de>
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-01-19 12:45:36 +01:00
Philip Molares
072ef223e0
config: splits config in multiple files
...
splits the big appConfig in multiple configs
adds media.config.mock.ts
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-01-15 16:57:04 +01:00
David Mehren
22e14fb706
NotesService: updateNoteByIdOrAlias
should return the new note
...
Fixes #702
Signed-off-by: David Mehren <git@herrmehren.de>
2021-01-10 20:30:45 +01:00
David Mehren
e8e82076d0
FilesystemBackend: Use scoped appConfig
...
Signed-off-by: David Mehren <git@herrmehren.de>
2021-01-08 12:53:16 +01:00
David Mehren
c4b61ae580
Note E2E tests: Check that create & update dates are updated correctly
...
Signed-off-by: David Mehren <git@herrmehren.de>
2021-01-10 20:12:21 +01:00
David Mehren
b7cb3181c4
NotesService: rename getLastRevision
to getLatestRevision
...
This fixes an inconsistency with `RevisionsService`
Signed-off-by: David Mehren <git@herrmehren.de>
2021-01-10 18:20:28 +01:00
David Mehren
a523eadec2
NotesController: Do not crash on nonexistent notes
...
This commit adds proper error handling and returns 404 when a note does not exist.
Previously, we leaked the `NotInDBError` and sent a 500 status code.
Signed-off-by: David Mehren <git@herrmehren.de>
2021-01-09 22:38:10 +01:00
David Mehren
3801b1b042
Format with Prettier 2
...
Signed-off-by: David Mehren <git@herrmehren.de>
2021-01-06 23:48:53 +01:00
Tilman Vatteroth
7aeaf488c4
Change year in copyright to 2021
...
Signed-off-by: Tilman Vatteroth <tilman.vatteroth@tu-dortmund.de>
2021-01-06 21:36:07 +01:00
David Mehren
890e9c942b
Fix prettier errors
...
Signed-off-by: David Mehren <git@herrmehren.de>
2021-01-05 23:11:31 +01:00
Philip Molares
dc63c76f43
added reuse information
...
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-01-05 22:12:38 +01:00
David Mehren
c0527c0942
Remove PUT /notes/{note}/metadata
and corresponding service code
...
Signed-off-by: David Mehren <git@herrmehren.de>
Co-authored-by: Yannick Bungers <git@innay.de>
2020-10-24 21:11:06 +02:00
David Mehren
9152f05c61
Add E2E tests for note metadata routes
...
Signed-off-by: David Mehren <git@herrmehren.de>
Co-authored-by: Yannick Bungers <git@innay.de>
2020-10-03 16:45:04 +02:00
David Mehren
4f60a79e4b
Use unique sqlite file for every E2E test
...
Previously, this lead to locking errors, when multiple test runners accessed the same database and tried to clear it or tried to insert new test data.
Signed-off-by: David Mehren <git@herrmehren.de>
2020-10-24 12:30:23 +02:00
David Mehren
fff46f0255
Add E2E tests for the /media
route
...
Signed-off-by: David Mehren <git@herrmehren.de>
2020-10-24 11:50:45 +02:00
David Mehren
1f22f47327
NotesService: Throw NotInDBError
when the note wasn't found
...
Signed-off-by: David Mehren <git@herrmehren.de>
2020-10-17 18:47:10 +02:00
David Mehren
95a809f0a3
Collect coverage information for E2E tests
...
As proposed in https://github.com/nestjs/nest/issues/3169#issuecomment-588287478
Signed-off-by: David Mehren <git@herrmehren.de>
2020-10-03 18:00:12 +02:00
David Mehren
e37722a56a
Switch to using the new custom logger
...
Signed-off-by: David Mehren <git@herrmehren.de>
2020-09-27 21:48:42 +02:00
Yannick Bungers
d1bfa5e4c7
Changed let to const to make eslint happy
...
Signed-off-by: Yannick Bungers <git@innay.de>
2020-09-26 23:47:51 +02:00
Yannick Bungers
79dd9af988
Added await to wait for completion of note creation in tests
...
Signed-off-by: Yannick Bungers <git@innay.de>
2020-09-26 23:40:15 +02:00
Yannick Bungers
6a98412285
Added tests test functions for /me routes
...
Note that they don't contain the functions from the services yet.
Signed-off-by: Yannick Bungers <git@innay.de>
2020-09-26 23:27:24 +02:00
David Mehren
a61127dbd6
Note E2E tests: Use response.body
to get the note content
...
Signed-off-by: David Mehren <git@herrmehren.de>
2020-09-22 21:46:32 +02:00
David Mehren
3c711e8cb8
Note E2E tests: Use the correct revision-id when checking GET /notes/{note}/revisions/{revision-id}
...
Signed-off-by: David Mehren <git@herrmehren.de>
2020-09-22 21:45:56 +02:00
David Mehren
4649b6e796
Note E2E tests: The response for the /notes/<id>/revision route does not contain a revisions
property
...
Signed-off-by: David Mehren <git@herrmehren.de>
2020-09-22 21:11:56 +02:00
David Mehren
711358ec0c
Note E2E tests: Await all note-creations and fix test for note-deletion.
...
Signed-off-by: David Mehren <git@herrmehren.de>
2020-09-22 21:10:09 +02:00
David Mehren
2030141c66
Note E2E tests: Use on-disk sqlite to aid debugging
...
It was helpful to inspect database contents while the code was stopped by the debugger. Therefore the E2E test database is now persisted on disk and cleared before every test-run.
Signed-off-by: David Mehren <git@herrmehren.de>
2020-09-22 20:09:36 +02:00
David Mehren
cccd52d1b0
Note E2E tests: Set a non-JSON content-type to avoid Nest trying to parse markdown to JSON.
...
Nest automatically tries to parse incoming requests with application/json as content-type and responds with HTTP 400 if the parsing fails. As our test-note-content is not valid JSON, we need to set another content-type.
Signed-off-by: David Mehren <git@herrmehren.de>
2020-09-22 18:30:22 +02:00
David Mehren
c43448624b
Restructure test setup in Note E2E tests to not load the whole application
...
Signed-off-by: David Mehren <git@herrmehren.de>
2020-09-22 18:27:35 +02:00
David Mehren
8145fc48d1
Update Note E2E tests to use new getNoteDtoByIdOrAlias
method
...
Signed-off-by: David Mehren <git@herrmehren.de>
2020-09-22 17:53:17 +02:00
David Mehren
bbba2fc348
Add E2E tests for /notes route
...
Most tests already test the correct thing, but all obviously fail because nothing is implemented yet.
Signed-off-by: David Mehren <git@herrmehren.de>
2020-08-21 21:16:20 +02:00
David Mehren
f77cfce0b2
Add Jest config for E2E tests
...
Signed-off-by: David Mehren <git@herrmehren.de>
2020-08-21 21:13:11 +02:00