minor test improvements

main
Inga 🏳‍🌈 11 months ago
parent 8a36b28fa7
commit ba14ca1830
  1. 2
      package.json
  2. 2
      solution.md
  3. 10
      src/movies.controller.spec.ts

@ -15,7 +15,7 @@
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\"",
"test": "jest",
"test:watch": "jest --watch",
"test:cov": "jest --coverage",
"test:cov": "npm run test -- --coverage",
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
"test:e2e": "OMDB_API_KEY=68fd98ab jest --config ./test/jest-e2e.json"
},

@ -189,7 +189,7 @@ who did not enter any search filters), so I return a 400 Bad Request errors for
## Testing
The code is mostly covered by tests.
The code is mostly (according to `npm run test:cov`, plus e2e tests) covered by tests.
I did not have any time to come up with good test cases, so most tests work on samples of data from OMDB and on provided sample JSONs.

@ -32,8 +32,16 @@ describe('AppController', () => {
});
});
it('should return 404 for unknown imdb id', () => {
expect(() => moviesController.getMovie('tt7394674')).toThrow(
'Not Found',
);
});
it('should throw an error for empty search query', () => {
expect(() => moviesController.searchMovies({})).toThrow();
expect(() => moviesController.searchMovies({})).toThrow(
'Query should not be empty',
);
});
it('should return movies matching writer', () => {

Loading…
Cancel
Save