-
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Target Node.js 18, switch to
ky
(#21)
- Loading branch information
1 parent
0ea3f07
commit 7a5c6c5
Showing
6 changed files
with
57 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,41 @@ | ||
import test from 'ava'; | ||
import npmUser from './index.js'; | ||
|
||
const avatarRegex = /^https:\/\/www\.npmjs\.com\/npm-avatar\//m; | ||
|
||
test('user: sindresorhus', async t => { | ||
const user = await npmUser('sindresorhus'); | ||
t.is(user.name, 'Sindre Sorhus'); | ||
t.regex(user.avatar, /npm-avatar/); | ||
t.is(user.email, 'sindresorhus@gmail.com'); | ||
|
||
t.like(user, { | ||
name: 'Sindre Sorhus', | ||
email: 'sindresorhus@gmail.com', | ||
github: 'sindresorhus', | ||
twitter: 'sindresorhus', | ||
}); | ||
|
||
t.regex(user.avatar, avatarRegex); | ||
}); | ||
|
||
test('user: npm', async t => { | ||
const user = await npmUser('npm'); | ||
t.is(user.name, 'No Problem, Meatbag'); | ||
t.regex(user.avatar, /npm-avatar/); | ||
t.is(user.email, 'npm@npmjs.com'); | ||
|
||
t.like(user, { | ||
name: 'No Problem, Meatbag', | ||
email: 'npm@npmjs.com', | ||
}); | ||
|
||
t.regex(user.avatar, avatarRegex); | ||
}); | ||
|
||
test('user: tj', async t => { | ||
const user = await npmUser('tj'); | ||
t.is(user.name, undefined); | ||
t.regex(user.avatar, /npm-avatar/); | ||
t.is(user.email, 'tj@vision-media.ca'); | ||
t.is(user.github, undefined); | ||
t.is(user.twitter, undefined); | ||
|
||
t.like(user, { | ||
name: undefined, | ||
email: 'tj@vision-media.ca', | ||
github: undefined, | ||
twitter: undefined, | ||
}); | ||
|
||
t.regex(user.avatar, avatarRegex); | ||
}); |