Skip to content

Instantly share code, notes, and snippets.

@ArCiGo
Last active January 30, 2023 00:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ArCiGo/6817db70c4455175fee6f42d124b0073 to your computer and use it in GitHub Desktop.
Save ArCiGo/6817db70c4455175fee6f42d124b0073 to your computer and use it in GitHub Desktop.
describe('Banking mock server API tests', () => {
it('should withdraw money successfully from an existing account', () => {
cy.fixture('requests/withdrawalsPostRequest').then((bodyRequest) => {
cy.request('POST', '/withdrawals', { bodyRequest }).then((response) => {
expect(response.isOkStatusCode).to.be.true;
expect(response.status).to.be.eq(200);
cy.fixture('responses/withdrawalsPostResponse').should('deep.equal', response.body);
});
});
});
it('should get a balance of an existing account', function() {
cy.request('GET', '/balance/' + this.account).then((response) => {
expect(response.isOkStatusCode).to.be.true;
expect(response.status).to.be.eq(200);
cy.fixture('responses/balanceGetResponse').should('deep.equal', response.body);
});
});
it('should transfer money successfully to an existing account', () => {
cy.fixture('requests/transfersPostRequest').then((bodyRequest) => {
cy.request('POST', '/transfers', { bodyRequest }).then((response) => {
expect(response.isOkStatusCode).to.be.true;
expect(response.status).to.be.eq(200);
cy.fixture('responses/transfersPostResponse').should('deep.equal', response.body)
});
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment