This repository has been archived by the owner on Nov 14, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
156 additions
and
36 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
'use strict'; | ||
|
||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.browse = browse; | ||
|
||
var _fetch = require('./lib/fetch'); | ||
|
||
function browse() { | ||
var args = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0]; | ||
var config = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; | ||
|
||
return (0, _fetch.get)('feed', args, config).then(_fetch.postProcess); | ||
} |
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { get, postProcess } from './lib/fetch'; | ||
|
||
export function browse(args = {}, config = {}) { | ||
return get('feed', args, config) | ||
.then(postProcess); | ||
} |
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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
'use strict'; | ||
|
||
var _mocha = require('mocha'); | ||
|
||
var _chai = require('chai'); | ||
|
||
var _utils = require('../lib/utils'); | ||
|
||
var _feed = require('../../dist/feed'); | ||
|
||
(0, _mocha.describe)('feed.browse', function () { | ||
var cookie = process.env.COOKIE; | ||
|
||
(0, _mocha.it)('should be defined,\n return a Promise,\n and fail if no authenticated', function (done) { | ||
_chai.assert.ok(_feed.browse); | ||
_chai.assert.typeOf((0, _feed.browse)(), 'Promise'); | ||
(0, _utils.shouldFail)((0, _feed.browse)(), done); | ||
}); | ||
|
||
(0, _mocha.it)('should succeed if authenticated', function (done) { | ||
(0, _utils.shouldSucceed)((0, _feed.browse)({}, { cookie: cookie }), function (feeds) { | ||
_chai.assert.isArray(feeds); | ||
}, done); | ||
}); | ||
}); |
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,33 @@ | ||
import { describe, it } from 'mocha'; | ||
import { assert } from 'chai'; | ||
import { shouldFail, shouldSucceed } from '../lib/utils'; | ||
|
||
import { browse } from '../../dist/feed'; | ||
|
||
describe('feed.browse', () => { | ||
const cookie = process.env.COOKIE; | ||
|
||
it( | ||
`should be defined, | ||
return a Promise, | ||
and fail if no authenticated`, | ||
done => { | ||
assert.ok(browse); | ||
assert.typeOf(browse(), 'Promise'); | ||
shouldFail(browse(), done); | ||
} | ||
); | ||
|
||
it( | ||
`should succeed if authenticated`, | ||
done => { | ||
shouldSucceed( | ||
browse({}, { cookie }), | ||
feeds => { | ||
assert.isArray(feeds); | ||
}, | ||
done | ||
); | ||
} | ||
); | ||
}); |