Skip to content

Instantly share code, notes, and snippets.

View ArCiGo's full-sized avatar
🎯
Learning

Armando Cifuentes ArCiGo

🎯
Learning
View GitHub Profile
describe('Banking mock server API tests', () => {
it('should deposit money successfully to an existing account', () => {
cy.fixture('requests/depositsPostRequest').then((bodyRequest) => {
cy.request('POST', '/deposits', { bodyRequest }).then((response) => {
expect(response.isOkStatusCode).to.be.true;
expect(response.status).to.be.eq(200);
cy.fixture('responses/depositsPostResponse').should('deep.equal', response.body);
});
});
describe('Banking mock server API tests', () => {
it('should post a user successfully', () => {
cy.fixture('requests/usersPostRequest').then((bodyRequest) => {
cy.request('POST', '/users', { bodyRequest }).then((response) => {
expect(response.isOkStatusCode).to.be.true;
expect(response.status).to.be.eq(200);
cy.fixture('responses/usersPostResponse').should('deep.equal', response.body);
/**
{
"id": "9b157424-90c0-462e-ae57-86e895248ed1",
"status": "Successful",
"name": "Matelda",
"firstLastName": "Ivimey",
"secondLastName": "Yousef",
"CURP": "COEA791226MGRRVM07",
"RFC": "COEA791226D68",
"account": "374283589513936",
"dateTime": "6/18/2022T17:35"
{
"name": "Matelda",
"firstLastName": "Ivimey",
"secondLastName": "Yousef",
"CURP": "COEA791226MGRRVM07",
"RFC": "COEA791226D68"
}
SELECT DISTINCT supp.Country
FROM Supplier supp
ORDER BY supp.Country
/** Output **/
Country
----------------------------------------
Australia
Brazil
Canada
SELECT DISTINCT "column_name"
FROM "table_name"
/** With aggregate functions **/
SELECT COUNT(DISTINCT "column_name")
FROM "table_name"
IF EXISTS(SELECT 1 FROM sys.objects WHERE name = 'StripWWWandCom')
DROP PROC StripWWWandCom
GO
CREATE FUNCTION StripWWWandCom(
@pInput VARCHAR(250)
)
RETURNS VARCHAR(250)
AS
BEGIN
IF EXISTS(SELECT 1 FROM sys.procedures WHERE name = 'spCustomerIns')
DROP PROC spCustomerIns
GO
CREATE PROC spCustomerIns(
@pId INT OUT,
@pFirstName NVARCHAR(MAX),
@pLastName NVARCHAR(MAX),
@pCity NVARCHAR(MAX),
@pCountry NVARCHAR(MAX),
@pPhone NVARCHAR(MAX)
-- Let's create a database in our DBMS
IF NOT EXISTS (SELECT * FROM sys.databases WHERE name = 'db_test')
BEGIN
CREATE DATABASE db_test;
END
-- Using the database we created previously
USE db_test;
SELECT *
FROM [ORDER]
/** Output **/
Id OrderDate OrderNumber CustomerId TotalAmount
----------- ----------------------- ----------- ----------- ---------------------------------------
1 2012-07-04 00:00:00.000 542378 85 440.00
2 2012-07-05 00:00:00.000 542379 79 1863.40
3 2012-07-08 00:00:00.000 542380 34 1813.00
4 2012-07-08 00:00:00.000 542381 84 670.80