Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F91956749
configurable-component.spec.ts
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sat, Nov 16, 02:59
Size
1 KB
Mime Type
text/x-c++
Expires
Mon, Nov 18, 02:59 (2 d)
Engine
blob
Format
Raw Data
Handle
22353172
Attached To
rNIETZSCHEBETAAPP Nietzsche-Beta-App
configurable-component.spec.ts
View Options
import { ComponentFixture, TestBed, async } from '@angular/core/testing';
import { Configuration} from './models';
import { ConfigurableComponent } from './configurable-component';
const conf: Configuration = { '*': { 'success': true }}
class Test extends ConfigurableComponent {
success: boolean = false;
configuration: Configuration = conf;
constructor(){ super() }
testConfig(){
this.processConfiguration();
}
}
describe('ConfigurableComponent', () => {
it('should create the Object', ()=>{
expect(new ConfigurableComponent()).toBeTruthy();
});
it('should have a proper name', ()=>{
let test = new Test();
expect(test.getConfigurationName()).toEqual('Test');
});
it('should process * config', ()=>{
let test = new Test();
test.testConfig()
expect(test.success).toBeTruthy();
});
it('should update configuration', ()=>{
let a: Configuration = { 'a': { 'b': true, 'c': false}}
let b: Configuration = { 'a': { 'b': false}}
a = ConfigurableComponent.updateConfiguration(a, b)
expect(a).toEqual({ 'a': { 'b': false, 'c': false}});
a = { 'a': { 'b': true, 'c': false}}
b = { 'a': true}
a = ConfigurableComponent.updateConfiguration(a, b)
expect(a).toEqual({ 'a': true});
a = { 'a': { 'b': true, 'c': false}}
b = { 'a': { 'd': true}}
a = ConfigurableComponent.updateConfiguration(a, b)
expect(a).toEqual({ 'a': { 'b': true, 'c': false, 'd': true}});
});
});
Event Timeline
Log In to Comment