0
0
Angularframework~10 mins

TestBed configuration in Angular - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to import the necessary Angular testing module.

Angular
TestBed.configureTestingModule({ imports: [[1]] });
Drag options to blanks, or click blank then click option'
AHttpClientTestingModule
BBrowserModule
CFormsModule
DRouterModule
Attempts:
3 left
💡 Hint
Common Mistakes
Using BrowserModule instead of HttpClientTestingModule
Forgetting to import any module
2fill in blank
medium

Complete the code to declare the component under test.

Angular
TestBed.configureTestingModule({ declarations: [[1]] });
Drag options to blanks, or click blank then click option'
AFormsModule
BHttpClientTestingModule
CAppComponent
DRouterTestingModule
Attempts:
3 left
💡 Hint
Common Mistakes
Putting modules inside declarations
Not declaring the component at all
3fill in blank
hard

Fix the error in the TestBed setup to create a component fixture.

Angular
const fixture = TestBed.[1](AppComponent);
Drag options to blanks, or click blank then click option'
AcompileComponents
Binject
CconfigureTestingModule
DcreateComponent
Attempts:
3 left
💡 Hint
Common Mistakes
Using compileComponents instead of createComponent
Trying to inject component directly
4fill in blank
hard

Fill both blanks to properly configure TestBed with declarations and imports.

Angular
TestBed.configureTestingModule({ declarations: [[1]], imports: [[2]] });
Drag options to blanks, or click blank then click option'
AAppComponent
BHttpClientTestingModule
CFormsModule
DRouterTestingModule
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping declarations and imports
Forgetting to import testing modules
5fill in blank
hard

Fill all three blanks to create a TestBed configuration with declarations, imports, and providers.

Angular
TestBed.configureTestingModule({ declarations: [[1]], imports: [[2]], providers: [[3]] });
Drag options to blanks, or click blank then click option'
AAppComponent
BHttpClientTestingModule
CMyService
DFormsModule
Attempts:
3 left
💡 Hint
Common Mistakes
Putting services in imports or declarations
Forgetting to provide services