Skip to content

Commit

Permalink
- set testing in place, fixing minor bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
timothyde committed Aug 21, 2018
1 parent 378bdc8 commit b785583
Show file tree
Hide file tree
Showing 8 changed files with 5,260 additions and 5,626 deletions.
Empty file modified .babelrc.js
100755 → 100644
Empty file.
42 changes: 42 additions & 0 deletions __tests__/utils/challenges.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import challenges, { defaultWeek } from "../../utils/challenges";

test("should return week 1 data", () => {
const week = challenges({ week: 1 });
expect(week.getChallenges().length).not.toBe(0);
});

test("should return week 2 data", () => {
const week = challenges({ week: 2 });
expect(week.getChallenges().length).not.toBe(0);
});

test("should return week 3 data", () => {
const week = challenges({ week: 3 });
expect(week.getChallenges().length).not.toBe(0);
});

test("should return week 4 data", () => {
const week = challenges({ week: 4 });
expect(week.getChallenges().length).not.toBe(0);
});

test("should return week 5 data", () => {
const week = challenges({ week: 5 });
expect(week.getChallenges().length).not.toBe(0);
});

test("should return week 6 data", () => {
const week = challenges({ week: 6 });
expect(week.getChallenges().length).not.toBe(0);
});

test("should return empty week", () => {
expect(challenges().getChallenges().length).toBe(0);
expect(challenges({}).getChallenges().length).toBe(0);
expect(challenges({ week: "x" }).getChallenges().length).toBe(0);
});

test("should return a default week", () => {
expect(defaultWeek).toBeDefined();
expect(typeof defaultWeek).toBe("number");
});
4 changes: 4 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
setupFiles: ['<rootDir>/jest.setup.js'],
testPathIgnorePatterns: ['<rootDir>/.next/', '<rootDir>/node_modules/']
}
4 changes: 4 additions & 0 deletions jest.setup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { configure } from 'enzyme'
import Adapter from 'enzyme-adapter-react-16'

configure({ adapter: new Adapter() })
Loading

0 comments on commit b785583

Please sign in to comment.