Skip to content

Instantly share code, notes, and snippets.

View isabelandss's full-sized avatar
🖤

Isabela Neri dos Santos isabelandss

🖤
  • São Paulo, SP
View GitHub Profile
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="style.css">
<title>CSS</title>
</head>
<body>
it('should', async () => {
const componentMock = componenstDrag[0];
directive = new DragDirective(componentMock);
directive.setReferences();
const event = {
target: {
id: "id",
classList: {
add: jest.fn(),
}
it('should call messageServiceStub.warning when throw error', () => {
storeServiceStub.createStore = jest.fn().mockReturnValue(
throwError({
id: 'id',
}),
);
component.addStore(newStore);
expect(messageServiceStub.warning).toHaveBeenCalledWith('Houve um erro ao criar a loja');
});
import { Injectable } from '@angular/core';
import { FormBuilder, FormGroup } from '@angular/forms';
@Injectable({
providedIn: 'root',
})
export class FormBuilderService {
form: FormGroup;
<p>{{user.firstname}} {{user.lastname}} {{user.age}}</p>
"scripts": {
"test": "jest",
"test:watch": "jest --watchAll",
"test:watch:cvr": "jest --watchAll --coverage"
},
"jest": {
"preset": "jest-preset-angular",
"setupFilesAfterEnv": ["<rootDir>/setupJest.ts"]
}
@isabelandss
isabelandss / setupJest.ts
Last active August 17, 2020 17:28
Configuração do Jest
import 'jest-preset-angular';
import { Component, h, Prop } from '@stencil/core'
const getButtonClass = (classname, color, small) =>
`custom-button ${classname} ${color} ${small ? 'small' : ''}`
export type Color = 'primary' | 'secondary' | 'tertiary'
@Component({
tag: 'custom-button',
styleUrl: 'custom-button.css',
/* ....../index.spec.js */
const server = require('./server')
test('should true is equal true rs',() => {
//um teste qualquer apenas pra chamar o seu método e provocar o erro
server()
expect(true).toBe(true)
})