Files
probot/test/apps/setup.test.ts
Brandon Keepers f6946a0607 Probot Support for GitHub App Manifests (#650)
* Add button to setup GitHub app

* Add app.yml

* Add some comments to app.yml

* Associate events with permissions

* Allow configuring app with manifest

* Hacky version of callback URL for configuring app

* Remove manifest stuff for now

* Return nil if private key is not found

* Move setup stuff to a separate plugin

* Revert changes to default plugin

* Remove FIXME

* Revert changes to default template

* Use separate template for setup

* Fix lint warnings

* Convert test helper to typescript

* Initial test for setup app

* Require tests files to match `.test.(js|ts)`

* Account for multiple protocols in x-forwarded-proto

* Wrap pem in quotes

* Collapse class into request method for now

* run `refresh` after updating .env on Glitch

* Extract update-dotenv to a node module

* Create a smee url if one does not exist

* Hacky version of serving up the manifest

* WIP Manifest with code

* add comments for plan + figure out port

* using user-agent header for review lab

* add success view to redirect to after installation

* api is actually on github

* start making post

* fix quoting issue on POST

* everything is off review lab and on dotcom

* working version of app manifest flow

* Start trying to write tests against setup

* more refactor into thingerator; basic tests; write plans for other tests

* merge better..

* ok atom conflict handling broke

* hack the tests back together

* pass the tests 👊🏼

* moar test

* make it open in a new tab for Wil 💖

* make boolean work

* clean up logic, move messgae, just return html url not response

* clean up tests 👷🏾‍♀️

* rename Brandon's thingerator to manifest-creation
2018-09-26 15:22:11 -04:00

48 lines
1.1 KiB
TypeScript

import express from 'express'
import request from 'supertest'
import { Application } from '../../src'
import appFn from '../../src/apps/setup'
import { ManifestCreation } from '../../src/manifest-creation'
import { newApp } from './helper'
describe('Setup app', () => {
let server: express.Application
let app: Application
let setup: ManifestCreation
beforeEach(async () => {
app = newApp()
setup = new ManifestCreation()
setup.createWebhookChannel = jest.fn()
await appFn(app, setup)
server = express()
server.use(app.router)
})
describe('GET /probot', () => {
it('returns a 200 response', () => {
return request(server)
.get('/probot')
.expect(200)
})
})
describe('GET /probot/setup', () => {
it('returns a 200 response', () => {
return request(server)
.get('/probot')
.expect(200)
})
})
describe('GET /probot/success', () => {
it('returns a 200 response', () => {
return request(server)
.get('/probot/success')
.expect(200)
})
})
})