-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: typescript rewrite #560
Merged
Merged
Changes from 11 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
e00c926
feat: converting most of the library over to TS
erunion 456558f
feat: moving all unit tests over to TS, fixing issues
erunion 7cae873
fix: updating the ci workflow to build the dist
erunion 352b785
fix: various problems
erunion 6136c29
fix: refactoring the fetch wrapper to use the Headers API
erunion 512fff1
fix: broken tests
erunion 00e8c20
fix: better excluding the dist from jest
erunion edf839c
fix: refactoring away the dynamic command loading system for somethin…
erunion bee05e6
fix: update GHA workflow
kanadgupta d1bb83a
test(node12): point to right file path
kanadgupta f0d529d
chore: small jest config fix
kanadgupta f139205
chore: fix @actions/core import
kanadgupta 8662a2b
chore: fix core import in another spot
kanadgupta 963e8fb
chore: simplify debug command
kanadgupta c0bbb23
chore: updating contributing guidelines
kanadgupta 5ef9415
revert: use key variable rather than opts
kanadgupta 0bd3c2c
feat: stricter return types for commands
kanadgupta de29a7f
fix: another strict return type
kanadgupta 6d7b614
fix: another stricter return type
kanadgupta c27a59e
fix: use command-line-usage types
kanadgupta 624a65f
fix: more getSpecs types fixes
kanadgupta File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
coverage/ | ||
dist/ | ||
!.alexrc.js |
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,3 +1,4 @@ | ||
node_modules/ | ||
coverage/ | ||
dist/ | ||
node_modules/ | ||
swagger.json |
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 +1,2 @@ | ||
coverage/ | ||
dist/ |
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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 |
---|---|---|
@@ -0,0 +1,71 @@ | ||
import nock from 'nock'; | ||
|
||
import CategoriesCommand from '../../../src/cmds/categories'; | ||
import getAPIMock, { getAPIMockWithVersionHeader } from '../../helpers/get-api-mock'; | ||
|
||
const categories = new CategoriesCommand(); | ||
|
||
const key = 'API_KEY'; | ||
const version = '1.0.0'; | ||
|
||
describe('rdme categories', () => { | ||
beforeAll(() => nock.disableNetConnect()); | ||
|
||
afterEach(() => nock.cleanAll()); | ||
|
||
it('should error if no api key provided', () => { | ||
return expect(categories.run({})).rejects.toStrictEqual( | ||
new Error('No project API key provided. Please use `--key`.') | ||
); | ||
}); | ||
|
||
it('should return all categories for a single page', async () => { | ||
const getMock = getAPIMockWithVersionHeader(version) | ||
.persist() | ||
.get('/api/v1/categories?perPage=20&page=1') | ||
.basicAuth({ user: key }) | ||
.reply(200, [{ title: 'One Category', slug: 'one-category', type: 'guide' }], { | ||
'x-total-count': '1', | ||
}); | ||
|
||
const versionMock = getAPIMock().get(`/api/v1/version/${version}`).basicAuth({ user: key }).reply(200, { version }); | ||
|
||
await expect(categories.run({ key, version: '1.0.0' })).resolves.toBe( | ||
JSON.stringify([{ title: 'One Category', slug: 'one-category', type: 'guide' }], null, 2) | ||
); | ||
|
||
getMock.done(); | ||
versionMock.done(); | ||
}); | ||
|
||
it('should return all categories for multiple pages', async () => { | ||
const getMock = getAPIMockWithVersionHeader(version) | ||
.persist() | ||
.get('/api/v1/categories?perPage=20&page=1') | ||
.basicAuth({ user: key }) | ||
.reply(200, [{ title: 'One Category', slug: 'one-category', type: 'guide' }], { | ||
'x-total-count': '21', | ||
}) | ||
.get('/api/v1/categories?perPage=20&page=2') | ||
.basicAuth({ user: key }) | ||
.reply(200, [{ title: 'Another Category', slug: 'another-category', type: 'guide' }], { | ||
'x-total-count': '21', | ||
}); | ||
|
||
const versionMock = getAPIMock().get(`/api/v1/version/${version}`).basicAuth({ user: key }).reply(200, { version }); | ||
|
||
await expect(categories.run({ key, version: '1.0.0' })).resolves.toBe( | ||
JSON.stringify( | ||
[ | ||
{ title: 'One Category', slug: 'one-category', type: 'guide' }, | ||
{ title: 'Another Category', slug: 'another-category', type: 'guide' }, | ||
], | ||
null, | ||
2 | ||
) | ||
); | ||
|
||
getMock.done(); | ||
versionMock.done(); | ||
}); | ||
}); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hell yeah