Skip to content
Snippets Groups Projects
Commit 1acf74c1 authored by Angapay Divin's avatar Angapay Divin
Browse files

add test for admin/instance/dataset/components/attribute/general

parent c181968c
No related branches found
No related tags found
2 merge requests!72Develop,!66Resolve "Tests client: Tester le module dataset de la partie admin->instance"
/**
* This file is part of Anis Client.
*
* @copyright Laboratoire d'Astrophysique de Marseille / CNRS
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
import { generalComponents } from './index';
describe('[admin][instance][dataset][components][attribute][general] index', () => {
it('Test general index components', () => {
expect(generalComponents.length).toEqual(2);
});
});
/**
* This file is part of Anis Client.
*
* @copyright Laboratoire d'Astrophysique de Marseille / CNRS
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { TableGeneralComponent } from './table-general.component';
describe('[admin][instance][dataset][components][attribute][general] TableGeneralComponent', () => {
let component: TableGeneralComponent;
let fixture: ComponentFixture<TableGeneralComponent>;
beforeEach(() => {
TestBed.configureTestingModule({
declarations: [
TableGeneralComponent,
],
imports: [
BrowserAnimationsModule,
],
});
fixture = TestBed.createComponent(TableGeneralComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create the component', () => {
expect(component).toBeTruthy();
});
});
/**
* This file is part of Anis Client.
*
* @copyright Laboratoire d'Astrophysique de Marseille / CNRS
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
import { Component } from '@angular/core';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { ReactiveFormsModule } from '@angular/forms';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { Attribute, OutputFamily } from 'src/app/metamodel/models';
import { TrGeneralComponent } from './tr-general.component';
@Component({
selector: 'app-delete-btn'
})
class DeleteBtnComponent { }
describe('[admin][instance][dataset][components][attribute][general] TrDetailComponent', () => {
let component: TrGeneralComponent;
let fixture: ComponentFixture<TrGeneralComponent>;
beforeEach(() => {
TestBed.configureTestingModule({
declarations: [
TrGeneralComponent,
DeleteBtnComponent
],
imports: [
BrowserAnimationsModule,
ReactiveFormsModule
],
});
fixture = TestBed.createComponent(TrGeneralComponent);
component = fixture.componentInstance;
let attribute: Attribute;
component.attribute = { ...attribute, name: 'test', id: 0, label: 'test', form_label: 'test', description: 'test', primary_key: false };
fixture.detectChanges();
});
it('should create the component', () => {
expect(component).toBeTruthy();
});
it('submit() should emit with attribute and form.value', () => {
let spy = jest.spyOn(component.save, 'emit');
component.submit();
expect(spy).toHaveBeenCalledTimes(1);
expect(spy).toHaveBeenCalledWith({ ...component.attribute, ...component.form.value });
})
});
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment