Skip to content

Commit 36edb24

Browse files
committed
feat: test for github_created_at fields
1 parent aef3ea3 commit 36edb24

File tree

3 files changed

+67
-0
lines changed

3 files changed

+67
-0
lines changed

test/fixtures/auth/githubUserInfo.js

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,5 +101,49 @@ module.exports = () => {
101101
created_at: "2020-09-06T16:21:38Z",
102102
updated_at: "2023-07-26T09:29:37Z",
103103
},
104+
{
105+
id: "86847625",
106+
nodeId: "MDQ6VXNlcjg2ODQ3NjI1",
107+
displayName: "Ravi kumar",
108+
username: "ravikumar1002",
109+
profileUrl: "https://github.com/ravikumar1002",
110+
photos: [{ value: "https://avatars.githubusercontent.com/u/86847625?v=4" }],
111+
provider: "github",
112+
_raw: '{"login":"ravikumar1002","id":86847625,"node_id":"MDQ6VXNlcjg2ODQ3NjI1","avatar_url":"https://avatars.githubusercontent.com/u/86847625?v=4","gravatar_id":"","url":"https://api.github.com/users/ravikumar1002","html_url":"https://github.com/ravikumar1002","followers_url":"https://api.github.com/users/ravikumar1002/followers","following_url":"https://api.github.com/users/ravikumar1002/following{/other_user}","gists_url":"https://api.github.com/users/ravikumar1002/gists{/gist_id}","starred_url":"https://api.github.com/users/ravikumar1002/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ravikumar1002/subscriptions","organizations_url":"https://api.github.com/users/ravikumar1002/orgs","repos_url":"https://api.github.com/users/ravikumar1002/repos","events_url":"https://api.github.com/users/ravikumar1002/events{/privacy}","received_events_url":"https://api.github.com/users/ravikumar1002/received_events","type":"User","site_admin":false,"name":"Ravi kumar","company":null,"blog":"https://ravikumar.dev/","location":"Delhi, India","email":null,"hireable":null,"bio":"Frontend developer","twitter_username":"kumarravi1002","public_repos":47,"public_gists":0,"followers":9,"following":13,"created_at":"2021-07-02T16:40:44Z","updated_at":"2023-07-27T00:12:32Z"}',
113+
_json: {
114+
login: "ravikumar1002",
115+
id: 86847625,
116+
node_id: "MDQ6VXNlcjg2ODQ3NjI1",
117+
avatar_url: "https://avatars.githubusercontent.com/u/86847625?v=4",
118+
gravatar_id: "",
119+
url: "https://api.github.com/users/ravikumar1002",
120+
html_url: "https://github.com/ravikumar1002",
121+
followers_url: "https://api.github.com/users/ravikumar1002/followers",
122+
following_url: "https://api.github.com/users/ravikumar1002/following{/other_user}",
123+
gists_url: "https://api.github.com/users/ravikumar1002/gists{/gist_id}",
124+
starred_url: "https://api.github.com/users/ravikumar1002/starred{/owner}{/repo}",
125+
subscriptions_url: "https://api.github.com/users/ravikumar1002/subscriptions",
126+
organizations_url: "https://api.github.com/users/ravikumar1002/orgs",
127+
repos_url: "https://api.github.com/users/ravikumar1002/repos",
128+
events_url: "https://api.github.com/users/ravikumar1002/events{/privacy}",
129+
received_events_url: "https://api.github.com/users/ravikumar1002/received_events",
130+
type: "User",
131+
site_admin: false,
132+
name: "Ravi kumar",
133+
company: null,
134+
blog: "https://ravikumar.dev/",
135+
location: "Delhi, India",
136+
email: null,
137+
hireable: null,
138+
bio: "Frontend developer",
139+
twitter_username: "kumarravi1002",
140+
public_repos: 47,
141+
public_gists: 0,
142+
followers: 9,
143+
following: 13,
144+
created_at: "2021-07-02T16:40:44Z",
145+
updated_at: "2023-07-27T00:12:32Z",
146+
},
147+
},
104148
];
105149
};

test/fixtures/user/user.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,5 +343,20 @@ module.exports = () => {
343343
updated_at: Date.now(),
344344
created_at: Date.now(),
345345
},
346+
{
347+
username: "ravikumar1002",
348+
first_name: "ravi",
349+
last_name: "kumar",
350+
github_id: githubUserInfo[2].username,
351+
github_display_name: githubUserInfo[2].displayName,
352+
github_created_at: Number(new Date(githubUserInfo[2]._json.created_at).getTime()),
353+
roles: {
354+
member: false,
355+
in_discord: true,
356+
},
357+
incompleteUserDetails: false,
358+
updated_at: Date.now(),
359+
created_at: Date.now(),
360+
},
346361
];
347362
};

test/unit/models/users.test.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,14 @@ describe("users", function () {
102102
expect(user).to.haveOwnProperty("updated_at");
103103
expect(userExists).to.equal(true);
104104
});
105+
106+
it("It should have github_created_at fields", async function () {
107+
const userData = userDataArray[15];
108+
await users.addOrUpdate(userData);
109+
const githubUsername = "ravikumar1002";
110+
const { user } = await users.fetchUser({ githubUsername });
111+
expect(user).to.haveOwnProperty("github_created_at");
112+
});
105113
});
106114

107115
describe("user image verification", function () {

0 commit comments

Comments
 (0)