ncc-prototype-email-alerts-sub
Version:
Northumberland Council Front End Email Alerts Subscription Prototype
29 lines (19 loc) • 906 B
text/typescript
import request from "supertest";
import getConfig from "../../libs/config";
import getApp from '../../app'
describe('selectAdressPageRouter', () => {
const config = getConfig();
config.env = "test";
const app = getApp(config);
const appRequest = request(app);
test('should redirect to same with error when no value is selected', async () => {
const response = await appRequest.post('/address-select').send({ address: '' });
expect(response.status).toBe(302);
expect(response.text).toContain('Found. Redirecting to /address-select?hasError=true')
})
test('should redirect to demo page when address is selected', async () => {
const response = await appRequest.post('/address-select').send({ address: '100110668168' });
expect(response.status).toBe(302);
expect(response.header['location']).toContain('/demo');
})
});