ryanhugh / searchneu

Search over Classes, Professors and Employees at NEU!
https://searchneu.com
GNU Affero General Public License v3.0
74 stars 18 forks source link

More comprehensive test suites #35

Open edward-shen opened 6 years ago

edward-shen commented 6 years ago

Currently some of our code remains untested, e.g. addprereqsfor and home.js.

Lets fix that.

Also we should definitely have more descriptive test suites, e.g. in backend/scrapers/employees/tests/coe.test.js:

it('should parse q', async (done) => {
  const body = await fs.readFile(path.join(__dirname, 'data', 'coe', 'letter q.html'));

  const retVal = coe.scrapeLetter(body);
  expect(retVal.length).toEqual(0);
  done();
});

it('should parse q', async (done) => {
  const body = await fs.readFile(path.join(__dirname, 'data', 'coe', 'detail page.html'));

  const retVal = coe.scrapeDetailpage(body);
  expect(retVal).toMatchSnapshot();
  done();
});
ryanhugh commented 6 years ago

Just added the first two unit tests in the frontend. We can probably do the rest in a similar way

ryanhugh commented 6 years ago

Just added tests for most of the files in the frontend and changed the name of the second test in your comment! We could add more detailed tests for a bunch of the files in the frontend if we want to add them. https://github.com/ryanhugh/searchneu/pull/41

edward-shen commented 6 years ago

Lets aim for 90%+ coverage!

ryanhugh commented 6 years ago

😱😱😱😱😱