Skip to content

Commit a624761

Browse files
include notice with test
1 parent c1eef72 commit a624761

File tree

1 file changed

+20
-19
lines changed

1 file changed

+20
-19
lines changed

test/app.test.js

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ const proxyquire = require('proxyquire');
77
const request = require('supertest-as-promised');
88

99
const db = {};
10+
const noticeValue = 'v1 is being deprecated. Use v2 instead. See https://analytics.usa.gov/developer'
1011

1112
const app = proxyquire('../src/app', {
1213
'./db': db
@@ -22,8 +23,8 @@ describe('app', () => {
2223
expect(params.reportAgency).to.equal('fake-agency');
2324
expect(params.reportName).to.equal('fake-report');
2425
return Promise.resolve([
25-
{ id: 1, date: new Date('2017-01-01') },
26-
{ id: 2, date: new Date('2017-01-02') }
26+
{ id: 1, date: new Date('2017-01-01'), notice: `${noticeValue}` },
27+
{ id: 2, date: new Date('2017-01-02'), notice: `${noticeValue}` }
2728
]);
2829
};
2930

@@ -33,8 +34,8 @@ describe('app', () => {
3334

3435
dataRequest.then(response => {
3536
expect(response.body).to.deep.equal([
36-
{ id: 1, date: '2017-01-01' },
37-
{ id: 2, date: '2017-01-02' }
37+
{ id: 1, date: '2017-01-01', notice: `${noticeValue}` },
38+
{ id: 2, date: '2017-01-02', notice: `${noticeValue}` }
3839
]);
3940
done();
4041
}).catch(done);
@@ -45,8 +46,8 @@ describe('app', () => {
4546
expect(params.reportAgency).to.be.undefined;
4647
expect(params.reportName).to.equal('fake-report');
4748
return Promise.resolve([
48-
{ id: 1, date: new Date('2017-01-01') },
49-
{ id: 2, date: new Date('2017-01-02') }
49+
{ id: 1, date: new Date('2017-01-01'), notice: `${noticeValue}` },
50+
{ id: 2, date: new Date('2017-01-02'), notice: `${noticeValue}` }
5051
]);
5152
};
5253

@@ -56,8 +57,8 @@ describe('app', () => {
5657

5758
dataRequest.then(response => {
5859
expect(response.body).to.deep.equal([
59-
{ id: 1, date: '2017-01-01' },
60-
{ id: 2, date: '2017-01-02' }
60+
{ id: 1, date: '2017-01-01', notice: `${noticeValue}` },
61+
{ id: 2, date: '2017-01-02', notice: `${noticeValue}` }
6162
]);
6263
done();
6364
}).catch(done);
@@ -69,8 +70,8 @@ describe('app', () => {
6970
expect(params.reportName).to.equal('fake-report');
7071
expect(params.limit).to.equal('50');
7172
return Promise.resolve([
72-
{ id: 1, date: new Date('2017-01-01') },
73-
{ id: 2, date: new Date('2017-01-02') }
73+
{ id: 1, date: new Date('2017-01-01'), notice: `${noticeValue}` },
74+
{ id: 2, date: new Date('2017-01-02'), notice: `${noticeValue}` }
7475
]);
7576
};
7677

@@ -80,8 +81,8 @@ describe('app', () => {
8081

8182
dataRequest.then(response => {
8283
expect(response.body).to.deep.equal([
83-
{ id: 1, date: '2017-01-01' },
84-
{ id: 2, date: '2017-01-02' }
84+
{ id: 1, date: '2017-01-01', notice: `${noticeValue}` },
85+
{ id: 2, date: '2017-01-02', notice: `${noticeValue}` }
8586
]);
8687
done();
8788
}).catch(done);
@@ -131,7 +132,7 @@ describe('app', () => {
131132
expect(params.domain).to.equal('fakeiscool.gov');
132133
expect(params.reportName).to.equal('site');
133134
return Promise.resolve([
134-
{ id: 1, report_name: 'site', date: new Date('2017-01-01'), data: { domain: 'fakeiscool.gov' } }
135+
{ id: 1, date: new Date('2017-01-01'), notice: `${noticeValue}`, report_name: 'site', data: { domain: 'fakeiscool.gov' } }
135136
]);
136137
};
137138

@@ -141,7 +142,7 @@ describe('app', () => {
141142

142143
dataRequest.then(response => {
143144
expect(response.body).to.deep.equal([
144-
{ id: 1, date: '2017-01-01', report_name: 'site', domain: 'fakeiscool.gov' }
145+
{ id: 1, date: '2017-01-01', notice: `${noticeValue}`, report_name: 'site', domain: 'fakeiscool.gov' }
145146
]);
146147
done();
147148
}).catch(done);
@@ -152,9 +153,9 @@ describe('app', () => {
152153
expect(params.domain).to.equal('fakeiscool.gov');
153154
expect(params.reportName).to.equal('download');
154155
return Promise.resolve([
155-
{ id: 1, date: new Date('2017-01-01'), report_name: 'download', data: { page: 'fakeiscool.gov/w8.pdf' } },
156-
{ id: 2, date: new Date('2017-01-02'), report_name: 'download', data: { page: 'fakeiscool.gov/westworldtheshow/w8.pdf' } },
157-
{ id: 3, date: new Date('2017-01-03'), report_name: 'download', data: { page: 'notiscool.gov/westworldtheshow/timewarpagain.pdf' } }
156+
{ id: 1, date: new Date('2017-01-01'), notice: `${noticeValue}`,report_name: 'download', data: { page: 'fakeiscool.gov/w8.pdf' } },
157+
{ id: 2, date: new Date('2017-01-02'), notice: `${noticeValue}`,report_name: 'download', data: { page: 'fakeiscool.gov/westworldtheshow/w8.pdf' } },
158+
{ id: 3, date: new Date('2017-01-03'), notice: `${noticeValue}`, report_name: 'download', data: { page: 'notiscool.gov/westworldtheshow/timewarpagain.pdf' } }
158159
]);
159160
};
160161

@@ -164,8 +165,8 @@ describe('app', () => {
164165

165166
dataRequest.then(response => {
166167
expect(response.body).to.deep.equal([
167-
{ id: 1, date: '2017-01-01', page: 'fakeiscool.gov/w8.pdf', report_name: 'download' },
168-
{ id: 2, date: '2017-01-02', report_name: 'download', page: 'fakeiscool.gov/westworldtheshow/w8.pdf' }
168+
{ id: 1, date: '2017-01-01', notice: `${noticeValue}`, page: 'fakeiscool.gov/w8.pdf', report_name: 'download' },
169+
{ id: 2, date: '2017-01-02', notice: `${noticeValue}`, report_name: 'download', page: 'fakeiscool.gov/westworldtheshow/w8.pdf' }
169170
]);
170171
done();
171172
}).catch(done);

0 commit comments

Comments
 (0)