Skip to content
This repository has been archived by the owner on Mar 17, 2024. It is now read-only.

Commit

Permalink
test: Fix request post request (#299)
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric Gustavsson authored Dec 25, 2020
1 parent 40f6f73 commit 67d9c63
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 47 deletions.
98 changes: 59 additions & 39 deletions package-lock.json

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

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@
"bluebird": "^3.5.5",
"lodash": "^4.17.15",
"promise-chains": "^0.3.11",
"request": "^2.87.0",
"request-promise": "^4.2.2",
"request": "^2.88.2",
"request-promise": "^4.2.6",
"ws": "^3.3.1"
},
"devDependencies": {
Expand Down
4 changes: 2 additions & 2 deletions src/snoowrap.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ declare class Snoowrap {
markNewModmailConversationsAsRead(convs: _ModmailConversation[]): Promise<void>;
markNewModmailConversationsAsUnread(convs: _ModmailConversation[]): Promise<void>;
getNewModmailSubreddits(): Promise<_Subreddit[]>;
getUnreadNewModmailConversationsCount(): Promise<{ highlighted: number, notifications: number, archived: number, new: number, inprogress: number, mod: number }>;
bulkReadNewModmail(subs: Array<_Subreddit | string>, state: 'new'|'inprogress'|'mod'|'notifications'|'archived'|'highlighted'|'all'): Promise<_Listing<_ModmailConversation>>;
getUnreadNewModmailConversationsCount(): Promise<{ highlighted: number, notifications: number, archived: number, appeals: number, new: number, inprogress: number, mod: number }>;
bulkReadNewModmail(subs: Array<_Subreddit | string>, state: 'new'|'inprogress'|'mod'|'notifications'|'archived'|'appeals'|'highlighted'|'all'): Promise<_Listing<_ModmailConversation>>;
getNewSubreddits(options?: ListingOptions): Promise<_Listing<_Subreddit>>;
getOauthScopeList(): Promise<{ [key: string]: { description: string; id: string; name: string } }>;
getPopularSubreddits(options?: ListingOptions): Promise<_Listing<_Subreddit>>;
Expand Down
10 changes: 6 additions & 4 deletions test/snoowrap.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,10 @@ describe('snoowrap', function () {
baseUrl: 'https://www.reddit.com/'
});

const loginResponse = await defaultRequest.post({
uri: 'api/login',
form: {user: oauthInfo.username, passwd: oauthInfo.password, api_type: 'json'}
const loginResponse = await defaultRequest.post('api/login').form({
user: oauthInfo.username,
passwd: oauthInfo.password,
api_type: 'json'
});

expect(loginResponse.json.errors.length).to.equal(0);
Expand Down Expand Up @@ -907,7 +908,7 @@ describe('snoowrap', function () {
const timer_promise = Promise.delay(9999);
const expanded_l = await l.fetchMore({amount: 200});
expect(expanded_l).to.have.lengthOf(201);
expect(timer_promise.isFulfilled()).to.be.false();
expect(timer_promise.isFulfilled()).to.be.false('getTop timed out');
});
afterEach(() => {
r.config({request_delay: initial_request_delay});
Expand Down Expand Up @@ -2157,6 +2158,7 @@ describe('snoowrap', function () {
'highlighted',
'notifications',
'archived',
'appeals',
'new',
'inprogress',
'mod'
Expand Down

0 comments on commit 67d9c63

Please sign in to comment.