1
0
mirror of synced 2025-12-25 02:17:36 -05:00

updating libapp in one script and tests

This commit is contained in:
Grace Park
2021-06-23 10:46:10 -07:00
parent 6db9920658
commit 6c0b43a4bb
5 changed files with 13 additions and 13 deletions

View File

@@ -7,7 +7,7 @@ const app = require('../../lib/app')
const helpers = {}
const request = (method, route) => supertest(app)[method](route)
const request = (method, route) => supertest(app())[method](route)
helpers.get = async function (route, opts = { followRedirects: false, followAllRedirects: false, headers: {} }) {
let res = (opts.headers) ? await request('get', route).set(opts.headers) : await request('get', route)

View File

@@ -14,7 +14,7 @@ describe('POST /events', () => {
process.env.AIRTABLE_BASE_KEY = '$AIRTABLE_BASE_KEY$'
process.env.HYDRO_SECRET = '$HYDRO_SECRET$'
process.env.HYDRO_ENDPOINT = 'http://example.com/hydro'
agent = request.agent(app)
agent = request.agent(app())
const csrfRes = await agent.get('/en')
const $ = cheerio.load(csrfRes.text || '', { xmlMode: true })
csrfToken = $('meta[name="csrf-token"]').attr('content')

View File

@@ -126,7 +126,7 @@ describe('does not render survey prompt or contribution button', () => {
describe('JS and CSS assets', () => {
it('returns the expected CSS file > 2.18', async () => {
const result = await supertest(app)
const result = await supertest(app())
.get('/enterprise/2.18/dist/index.css')
.set('Referrer', '/en/enterprise/2.18')
@@ -136,7 +136,7 @@ describe('JS and CSS assets', () => {
})
it('returns the expected CSS file', async () => {
const result = await supertest(app)
const result = await supertest(app())
.get('/stylesheets/index.css')
.set('Referrer', '/en/enterprise/2.13')
@@ -146,7 +146,7 @@ describe('JS and CSS assets', () => {
})
it('returns the expected JS file > 2.18', async () => {
const result = await supertest(app)
const result = await supertest(app())
.get('/enterprise/2.18/dist/index.js')
.set('Referrer', '/en/enterprise/2.18')
@@ -156,7 +156,7 @@ describe('JS and CSS assets', () => {
})
it('returns the expected JS file', async () => {
const result = await supertest(app)
const result = await supertest(app())
.get('/javascripts/index.js')
.set('Referrer', '/en/enterprise/2.13')
@@ -166,7 +166,7 @@ describe('JS and CSS assets', () => {
})
it('returns the expected image', async () => {
const result = await supertest(app)
const result = await supertest(app())
.get('/assets/images/octicons/hamburger.svg')
.set('Referrer', '/en/enterprise/2.17')
@@ -176,7 +176,7 @@ describe('JS and CSS assets', () => {
})
it('returns the expected node_modules', async () => {
const result = await supertest(app)
const result = await supertest(app())
.get('/node_modules/algoliasearch/dist/algoliasearch.min.js')
.set('Referrer', '/en/enterprise/2.17')
@@ -186,7 +186,7 @@ describe('JS and CSS assets', () => {
})
it('returns the expected favicon', async () => {
const result = await supertest(app)
const result = await supertest(app())
.get('/assets/images/site/favicon.svg')
.set('Referrer', '/en/enterprise/2.18')
@@ -196,7 +196,7 @@ describe('JS and CSS assets', () => {
})
it('returns the expected CSS file ( <2.13 )', async () => {
const result = await supertest(app)
const result = await supertest(app())
.get('/assets/stylesheets/application.css')
.set('Referrer', '/en/enterprise/2.12')
@@ -206,7 +206,7 @@ describe('JS and CSS assets', () => {
})
it('ignores invalid paths', async () => {
const result = await supertest(app)
const result = await supertest(app())
.get('/pizza/index.css')
.set('Referrer', '/en/enterprise/2.13')

View File

@@ -103,7 +103,7 @@ describe('redirects', () => {
})
test('are redirected for HEAD requests (not just GET requests)', async () => {
const res = await supertest(app).head('/articles/closing-issues-via-commit-messages/')
const res = await supertest(app()).head('/articles/closing-issues-via-commit-messages/')
expect(res.statusCode).toBe(301)
expect(res.headers.location).toBe('/articles/closing-issues-via-commit-messages')
})