-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- test: ticket-revenues should return results
- Loading branch information
Showing
2 changed files
with
50 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { subDays } from 'date-fns'; | ||
import * as request from 'supertest'; | ||
import { getDateYMDString } from '../../src/utils/date-utils'; | ||
import { | ||
APP_URL, | ||
LICENSEE_PASSWORD, | ||
LICENSEE_PERMIT_CODE, | ||
} from '../utils/constants'; | ||
|
||
describe('Ticket revenues (e2e)', () => { | ||
const app = APP_URL; | ||
let apiToken: any; | ||
|
||
beforeAll(async () => { | ||
await request(app) | ||
.post('/api/v1/auth/licensee/login') | ||
.send({ permitCode: LICENSEE_PERMIT_CODE, password: LICENSEE_PASSWORD }) | ||
.expect(200) | ||
.then(({ body }) => { | ||
apiToken = body.token; | ||
}); | ||
}); | ||
|
||
it('should return some user result in /ticket-revenues/me', async () => { | ||
// Arrange | ||
const startDate = subDays(new Date(), 366); | ||
|
||
// Act | ||
let ticketRevenuesMe: any; | ||
await request(app) | ||
.get('/api/v1/ticket-revenues/me') | ||
.auth(apiToken, { | ||
type: 'bearer', | ||
}) | ||
.query({ | ||
startDate: getDateYMDString(startDate), | ||
endDate: getDateYMDString(new Date()), | ||
}) | ||
.expect(200) | ||
.then(({ body }) => { | ||
ticketRevenuesMe = body; | ||
}); | ||
|
||
// Assert | ||
expect(ticketRevenuesMe.data.length).toBeGreaterThan(0); | ||
}, 60000); | ||
}); |