Skip to content

Commit

Permalink
Removing plugin sanity checks - they predate our cypress tests, are h…
Browse files Browse the repository at this point in the history
…ard-coded with details from govuk-frontend and aren't particularly useful anymore.
  • Loading branch information
nataliecarey committed Aug 29, 2023
1 parent d262239 commit 3b52abc
Showing 1 changed file with 0 additions and 75 deletions.
75 changes: 0 additions & 75 deletions __tests__/spec/sanity-checks.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/* eslint-env jest */

// core dependencies
const assert = require('assert')
const path = require('path')

// npm dependencies
Expand Down Expand Up @@ -69,78 +68,4 @@ describe('The Prototype Kit', () => {
expect(response.type).toBe('text/html')
})
})

describe('plugins', () => {
it('should allow known assets to be loaded from node_modules', (done) => {
request(app)
.get('/plugin-assets/govuk-frontend/govuk/all.js')
.expect(200)
.expect('Content-Type', /application\/javascript; charset=UTF-8/)
.end((err, res) => {
if (err) {
done(err)
} else {
assert.strictEqual(
'' + res.text,
fse.readFileSync(path.join(projectDir, 'node_modules', 'govuk-frontend', 'govuk', 'all.js'), 'utf8')
)
done()
}
})
})

it('should allow known assets to be loaded from node_modules', (done) => {
request(app)
.get('/plugin-assets/govuk-frontend/govuk/assets/images/favicon.ico')
.expect(200)
.expect('Content-Type', /image\/x-icon/)
.end((err, res) => {
if (err) {
done(err)
} else {
assert.strictEqual(
'' + res.body,
fse.readFileSync(path.join(projectDir, 'node_modules', 'govuk-frontend', 'govuk', 'assets', 'images', 'favicon.ico'), 'utf8')
)
done()
}
})
})

it('should not expose everything', (done) => {
const consoleErrorMock = jest.spyOn(global.console, 'error').mockImplementation()

request(app)
.get('/govuk/assets/common.js')
.expect(404)
.end((err, res) => {
consoleErrorMock.mockRestore()
if (err) {
done(err)
} else {
done()
}
})
})

describe('misconfigured prototype kit - while updating kit developer did not copy over changes in /app folder', () => {
it('should still allow known assets to be loaded from node_modules', (done) => {
request(app)
.get('/plugin-assets/govuk-frontend/govuk/all.js')
.expect(200)
.expect('Content-Type', /application\/javascript; charset=UTF-8/)
.end((err, res) => {
if (err) {
done(err)
} else {
assert.strictEqual(
'' + res.text,
fse.readFileSync(path.join(projectDir, 'node_modules', 'govuk-frontend', 'govuk', 'all.js'), 'utf8')
)
done()
}
})
})
})
})
})

0 comments on commit 3b52abc

Please sign in to comment.