Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions controllers/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,10 @@ const githubAuthCallback = (req, res, next) => {
logger.error(err);
return res.boom.unauthorized("User cannot be authenticated");
}

userData = {
github_id: user.username,
github_display_name: user.displayName,
// github_account_created_at: user.created_at,
github_created_at: Number(new Date(user._json.created_at).getTime()),
created_at: Date.now(),
updated_at: Date.now(),
};
Expand Down
1 change: 1 addition & 0 deletions test/fixtures/user/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ module.exports = () => {
linkedin_id: "ankurnarkhede",
github_id: githubUserInfo[0].username,
github_display_name: githubUserInfo[0].displayName,
github_created_at: Number(new Date(githubUserInfo[0]._json.created_at).getTime()),
isMember: true,
phone: "1234567890",
email: "[email protected]",
Expand Down
8 changes: 8 additions & 0 deletions test/unit/models/users.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,14 @@ describe("users", function () {
expect(user).to.haveOwnProperty("updated_at");
expect(userExists).to.equal(true);
});

it("It should have github_created_at fields", async function () {
const userData = userDataArray[0];
await users.addOrUpdate(userData);
const githubUsername = "ankur";
const { user } = await users.fetchUser({ githubUsername });
expect(user).to.haveOwnProperty("github_created_at");
});
});

describe("user image verification", function () {
Expand Down