Skip to content

Commit

Permalink
chore #11: Create mock data for cards
Browse files Browse the repository at this point in the history
  • Loading branch information
Boosmith committed Aug 23, 2019
1 parent 5f8d252 commit 474c381
Show file tree
Hide file tree
Showing 4 changed files with 123 additions and 0 deletions.
6 changes: 6 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@
"node-fetch": "^2.3.0",
"npm-run-all": "^4.1.5",
"postcss-loader": "^3.0.0",
"random-words": "^1.1.0",
"redux-immutable-state-invariant": "^2.1.0",
"redux-mock-store": "^1.5.3",
"style-loader": "^0.23.1"
Expand Down
32 changes: 32 additions & 0 deletions src/tools/generateCards.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
const randomWords = require("random-words");

const words = randomWords({ exactly: 10, wordsPerString: 2 });

var mongoObjectId = function() {
var timestamp = ((new Date().getTime() / 1000) | 0).toString(16);
return (
timestamp +
"xxxxxxxxxxxxxxxx"
.replace(/[x]/g, function() {
return ((Math.random() * 16) | 0).toString(16);
})
.toLowerCase()
);
};

const generateCards = function() {
const cards = [];
for (let i = 0; i < 10; i++) {
let card = {
_id: mongoObjectId(),
title: words[i],
boardId: "",
status: "",
ownerId: ""
};
cards.push(card);
}
console.log(cards);
};

module.exports = generateCards();
84 changes: 84 additions & 0 deletions src/tools/mockData.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,85 @@
// Cards.
const cards = [
{
_id: "5d6020254ea3a4ab3ffc476b",
title: "material leather",
boardId: "",
status: "",
ownerId: ""
},
{
_id: "5d602025c1b269d1aeba775d",
title: "labor hearing",
boardId: "",
status: "",
ownerId: ""
},
{
_id: "5d6020255c4c086beb74fe3b",
title: "struck affect",
boardId: "",
status: "",
ownerId: ""
},
{
_id: "5d602025f80d7c1056749a9a",
title: "continent difficulty",
boardId: "",
status: "",
ownerId: ""
},
{
_id: "5d602025d4c222584dabbd78",
title: "screen forty",
boardId: "",
status: "",
ownerId: ""
},
{
_id: "5d602025a00dd4be2452e132",
title: "report forth",
boardId: "",
status: "",
ownerId: ""
},
{
_id: "5d602025e29e75c53bccc713",
title: "on faster",
boardId: "",
status: "",
ownerId: ""
},
{
_id: "5d6020252f61ab55e13cb823",
title: "sat upon",
boardId: "",
status: "",
ownerId: ""
},
{
_id: "5d6020253f49acf252b4b2a6",
title: "major something",
boardId: "",
status: "",
ownerId: ""
},
{
_id: "5d602025fd3db74ec9005051",
title: "faster specific",
boardId: "",
status: "",
ownerId: ""
}
];

const newCard = {
title: "",
boardId: "",
status: "",
ownerId: ""
};

// Users.
const users = [
{
_id: "5d42e5d5e1e3d731df26010a",
Expand Down Expand Up @@ -100,6 +182,8 @@ const newUser = {
};

module.exports = {
cards,
newCard,
newUser,
users
};

0 comments on commit 474c381

Please sign in to comment.