123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155 |
- const nock = require('nock')
- const GitHub = require('../../')
- require('../mocha-node-setup')
- describe('deprecations', () => {
- let github
- beforeEach(() => {
- github = new GitHub({
- baseUrl: 'https://deprecations-test.com'
- })
- cy.stub(console, 'warn')
- })
- it('github.integrations.*', () => {
- nock('https://deprecations-test.com')
- .get('/app/installations')
- .reply(200, [])
- return github.integrations.getInstallations({})
- .then(() => {
- expect(console.warn.callCount).to.equal(1)
- })
- })
- it('deprecated followRedirects option', () => {
- GitHub({
- followRedirects: false
- })
- expect(console.warn.callCount).to.equal(1)
- })
- it('deprecated protocol, host, port, pathPrefix options', () => {
- GitHub({
- protocol: 'https',
- host: 'deprecations-test.com',
- port: 1234,
- pathPrefix: '/deprecations-test.com/'
- })
- expect(console.warn.callCount).to.equal(4)
- // it logs same messages only once (#871)
- GitHub({
- protocol: 'https',
- host: 'deprecations-test.com',
- port: 1234,
- pathPrefix: '/deprecations-test.com/'
- })
- expect(console.warn.callCount).to.equal(4)
- })
- it('deprecated Promise option', () => {
- GitHub({
- Promise: {}
- })
- expect(console.warn.callCount).to.equal(1)
- })
- it('deprecated ca option', () => {
- GitHub({
- baseUrl: 'https://api.github.com',
- ca: 'certificate123'
- })
- expect(console.warn.callCount).to.equal(1)
- })
- it('deprecated proxy option', () => {
- GitHub({
- baseUrl: 'https://api.github.com',
- proxy: 'http://localhost:1234'
- })
- expect(console.warn.callCount).to.equal(1)
- })
- it('deprecated family option', () => {
- GitHub({
- baseUrl: 'https://api.github.com',
- family: 6
- })
- expect(console.warn.callCount).to.equal(1)
- })
- it('deprecated rejectUnauthorized option', () => {
- GitHub({
- baseUrl: 'https://api.github.com',
- rejectUnauthorized: false
- })
- expect(console.warn.callCount).to.equal(1)
- })
- it('deprecated client.activity.getEventsForRepoIssues()', () => {
- nock('https://deprecations-test.com')
- .get('/repos/foo/bar/issues/events')
- .reply(200, [])
- return github.activity.getEventsForRepoIssues({
- owner: 'foo',
- repo: 'bar'
- })
- .then(() => {
- expect(console.warn.callCount).to.equal(1)
- })
- })
- it('deprecated sha parameter for client.gitdata.getCommit({sha})', () => {
- nock('https://deprecations-test.com')
- .get('/repos/foo/bar/git/commits/sha123')
- .reply(200, {})
- return github.gitdata.getCommit({
- owner: 'foo',
- repo: 'bar',
- sha: 'sha123'
- })
- .then(() => {
- expect(console.warn.callCount).to.equal(1)
- })
- })
- it('deprecated authentication type "integration"', () => {
- nock('https://deprecations-test.com')
- .get('/app/installations')
- .reply(200, [])
- github.authenticate({
- type: 'integration',
- token: 'foo'
- })
- return github.apps.getInstallations({})
- .then(() => {
- expect(console.warn.callCount).to.equal(1)
- })
- })
- it('deprecated response.meta', () => {
- nock('https://deprecations-test.com')
- .get('/orgs/myorg')
- .reply(200, {})
- return github.orgs.get({org: 'myorg'})
- .then(response => {
- expect(response.meta).to.deep.equal(response.headers)
- expect(console.warn.callCount).to.equal(1)
- })
- })
- })
|