This file contains hidden or 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
const request = require("supertest"); | |
const { updatePluginStore, responseHasError } = require("./../helpers/strapi"); | |
const { createUser, defaultData, mockUserData } = require("./factory"); | |
const nodemailerMock = require("nodemailer-mock"); | |
describe("Default User methods", () => { | |
let user; | |
beforeAll(async (done) => { | |
user = await createUser(strapi); |
This file contains hidden or 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
const request = require("supertest"); | |
const userFactory = require("./../user/factory"); | |
const nodemailerMock = require("nodemailer-mock"); | |
// const { jwt, grantPrivilage } = require("./../helpers/strapi"); | |
describe("Reset password", () => { | |
let user; | |
beforeAll(async (done) => { | |
user = await userFactory.createUser(strapi); |
This file contains hidden or 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
// app | |
const add = (a, b) => a + b; | |
// TEST. framework jest | |
expect(add(2, 2)).toBe(4); |
This file contains hidden or 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
// app | |
const request = require("supertest"); | |
const app = require("express")(); | |
app.get("/user", (req, res) => res.status(200).json({ name: "john" })); | |
// TEST. framework jest | |
request(app) | |
.get("/user") | |
.expect("Content-Type", /json/) |
This file contains hidden or 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
// TEST. framework cypress | |
describe("My First Test", () => { | |
it("Gets, types and asserts", () => { | |
cy.visit("https://example.cypress.io"); | |
cy.contains("type").click(); | |
// Should be on a new URL which includes '/commands/actions' | |
cy.url().should("include", "/commands/actions"); | |
// Get an input, type into it and verify that the value has been updated | |
cy.get(".action-email") | |
.type("[email protected]") |
This file contains hidden or 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
// TEST. framework codeceptjs | |
Feature("My First Test"); | |
Scenario("test something", ({ I }) => { | |
I.amOnPage("https://github.com"); | |
I.see("GitHub"); | |
}); |
This file contains hidden or 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
// Jest | |
describe("Sum numbers", () => { | |
test("it should sum two numbers correctly", () => { | |
expect(1 + 2).toEqual(3); | |
}); | |
}); | |
// Jasmine | |
describe("Sum numbers", function () { | |
it("should sum two numbers correctly", function () { |
This file contains hidden or 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
beforeEach(() => { | |
initializeCityDatabase(); | |
}); | |
afterEach(() => { | |
clearCityDatabase(); | |
}); | |
test("city database has Vienna", () => { | |
expect(isCity("Vienna")).toBeTruthy(); |
This file contains hidden or 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
const should = require('should'); | |
const mockery = require('mockery'); | |
const nodemailerMock = require('nodemailer-mock'); | |
describe('Tests that send email', async () { | |
before(async () { | |
mockery.enable({warnOnUnregistered: false}); // Enable mockery to mock objects | |
mockery.registerMock('nodemailer', nodemailerMock) | |
}); |
This file contains hidden or 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
const should = require('should'); | |
const mockery = require('mockery'); | |
const nodemailerMock = require('nodemailer-mock'); | |
describe('Tests that send email', async () { | |
before(async () { | |
mockery.enable({warnOnUnregistered: false}); // Enable mockery to mock objects | |
mockery.registerMock('nodemailer', nodemailerMock) | |
}); |