Skip to content
This repository has been archived by the owner on Jul 9, 2019. It is now read-only.

Commit

Permalink
test nav reducer
Browse files Browse the repository at this point in the history
  • Loading branch information
johnthepink committed Nov 23, 2016
1 parent 28bca29 commit f37d26d
Show file tree
Hide file tree
Showing 2 changed files with 381 additions and 0 deletions.
306 changes: 306 additions & 0 deletions imports/store/nav/__tests__/__snapshots__/reducer.js.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,306 @@
exports[`test NAV.ANYTHING_ELSE 1`] = `
Object {
"bgColor": "#202020",
"fgColor": "dark",
"level": "TOP",
"links": Array [
Object {
"icon": "icon-logo",
"id": 1,
"isActive": [Function],
"label": "Home",
"link": "/",
},
Object {
"action": [Function],
"icon": "icon-sections",
"id": 2,
"isActive": [Function],
"label": "Sections",
},
Object {
"icon": "icon-groups",
"id": 3,
"isActive": [Function],
"label": "Groups",
"link": "/groups/finder",
},
Object {
"action": [Function],
"icon": "icon-search",
"id": 4,
"isActive": [Function],
"label": "Discover",
},
Object {
"icon": "icon-profile",
"id": 5,
"isActive": [Function],
"label": "Profile",
"link": "/profile/settings",
},
],
"visible": true,
}
`;

exports[`test NAV.RESET_COLOR 1`] = `
Object {
"bgColor": "#202020",
"fgColor": "dark",
"level": "TOP",
"links": Array [
Object {
"icon": "icon-logo",
"id": 1,
"isActive": [Function],
"label": "Home",
"link": "/",
},
Object {
"action": [Function],
"icon": "icon-sections",
"id": 2,
"isActive": [Function],
"label": "Sections",
},
Object {
"icon": "icon-groups",
"id": 3,
"isActive": [Function],
"label": "Groups",
"link": "/groups/finder",
},
Object {
"action": [Function],
"icon": "icon-search",
"id": 4,
"isActive": [Function],
"label": "Discover",
},
Object {
"icon": "icon-profile",
"id": 5,
"isActive": [Function],
"label": "Profile",
"link": "/profile/settings",
},
],
"visible": true,
}
`;

exports[`test NAV.SET_ACTION 1`] = `
Object {
"bgColor": "#202020",
"fgColor": "dark",
"level": "TOP",
"links": Array [
Object {
"action": "test",
"icon": "icon-logo",
"id": 1,
"isActive": [Function],
"label": "Home",
"link": "/",
},
Object {
"action": [Function],
"icon": "icon-sections",
"id": 2,
"isActive": [Function],
"label": "Sections",
},
Object {
"icon": "icon-groups",
"id": 3,
"isActive": [Function],
"label": "Groups",
"link": "/groups/finder",
},
Object {
"action": [Function],
"icon": "icon-search",
"id": 4,
"isActive": [Function],
"label": "Discover",
},
Object {
"icon": "icon-profile",
"id": 5,
"isActive": [Function],
"label": "Profile",
"link": "/profile/settings",
},
],
"visible": true,
}
`;

exports[`test NAV.SET_COLOR 1`] = `
Object {
"bgColor": "orange",
"fgColor": "purple",
"level": "TOP",
"links": Array [
Object {
"icon": "icon-logo",
"id": 1,
"isActive": [Function],
"label": "Home",
"link": "/",
},
Object {
"action": [Function],
"icon": "icon-sections",
"id": 2,
"isActive": [Function],
"label": "Sections",
},
Object {
"icon": "icon-groups",
"id": 3,
"isActive": [Function],
"label": "Groups",
"link": "/groups/finder",
},
Object {
"action": [Function],
"icon": "icon-search",
"id": 4,
"isActive": [Function],
"label": "Discover",
},
Object {
"icon": "icon-profile",
"id": 5,
"isActive": [Function],
"label": "Profile",
"link": "/profile/settings",
},
],
"visible": true,
}
`;

exports[`test NAV.SET_LEVEL 1`] = `
Object {
"bgColor": "red",
"fgColor": "blue",
"level": "CONTENT",
"links": Array [
Object {
"action": [Function],
"icon": "icon-arrow-back",
"id": 1,
},
Object {
"action": false,
"activeIcon": "icon-like-solid",
"icon": "icon-like",
"id": 2,
"isActive": [Function],
},
Object {
"action": [Function],
"icon": "icon-share",
"id": 3,
},
],
"visible": true,
}
`;

exports[`test NAV.SET_LINKS 1`] = `
Object {
"bgColor": "#202020",
"fgColor": "dark",
"level": "TOP",
"links": Array [
Object {
"icon": "icon-logo",
"id": 1,
"isActive": [Function],
"label": "Home",
"link": "/",
},
Object {
"action": [Function],
"icon": "icon-sections",
"id": 2,
"isActive": [Function],
"label": "Sections",
},
Object {
"icon": "icon-groups",
"id": 3,
"isActive": [Function],
"label": "Groups",
"link": "/groups/finder",
},
Object {
"action": [Function],
"icon": "icon-search",
"id": 4,
"isActive": [Function],
"label": "Discover",
},
Object {
"icon": "icon-profile",
"id": 5,
"isActive": [Function],
"label": "Profile",
"link": "/profile/settings",
},
"one",
"two",
],
"visible": true,
}
`;

exports[`test NAV.SET_VISIBILITY 1`] = `
Object {
"bgColor": "#202020",
"fgColor": "dark",
"level": "TOP",
"links": Array [
Object {
"icon": "icon-logo",
"id": 1,
"isActive": [Function],
"label": "Home",
"link": "/",
},
Object {
"action": [Function],
"icon": "icon-sections",
"id": 2,
"isActive": [Function],
"label": "Sections",
},
Object {
"icon": "icon-groups",
"id": 3,
"isActive": [Function],
"label": "Groups",
"link": "/groups/finder",
},
Object {
"action": [Function],
"icon": "icon-search",
"id": 4,
"isActive": [Function],
"label": "Discover",
},
Object {
"icon": "icon-profile",
"id": 5,
"isActive": [Function],
"label": "Profile",
"link": "/profile/settings",
},
],
"visible": false,
}
`;
75 changes: 75 additions & 0 deletions imports/store/nav/__tests__/reducer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
import reducer from "../reducer";

it("NAV.SET_LEVEL", () => {
const action = {
type: "NAV.SET_LEVEL",
level: "CONTENT",
bgColor: "red",
fgColor: "blue",
};
const result = reducer(undefined, action);
expect(result).toMatchSnapshot();
});

it("NAV.SET_LINKS", () => {
const action = {
type: "NAV.SET_LINKS",
links: ["one", "two"],
};
const result = reducer(undefined, action);
expect(result).toMatchSnapshot();
});

it("NAV.SET_COLOR", () => {
const action = {
type: "NAV.SET_COLOR",
bgColor: "orange",
fgColor: "purple",
};
const result = reducer(undefined, action);
expect(result).toMatchSnapshot();
});

it("NAV.RESET_COLOR", () => {
const action = {
type: "NAV.SET_COLOR",
bgColor: "orange",
fgColor: "purple",
};
reducer(undefined, action);
const action2 = {
type: "NAV.RESET_COLOR",
};
const result = reducer(undefined, action2);
expect(result).toMatchSnapshot();
});

it("NAV.SET_ACTION", () => {
const action = {
type: "NAV.SET_ACTION",
level: "TOP",
props: {
id: 1,
action: "test",
},
};
const result = reducer(undefined, action);
expect(result).toMatchSnapshot();
});

it("NAV.SET_VISIBILITY", () => {
const action = {
type: "NAV.SET_VISIBILITY",
visible: false,
};
const result = reducer(undefined, action);
expect(result).toMatchSnapshot();
});

it("NAV.ANYTHING_ELSE",() => {
const action = {
type: "NAV.ANYTHING_ELSE",
};
const result = reducer(undefined, action);
expect(result).toMatchSnapshot();
});

0 comments on commit f37d26d

Please sign in to comment.