File tree Expand file tree Collapse file tree 2 files changed +0
-9
lines changed
src/example-02/birds/_factory Expand file tree Collapse file tree 2 files changed +0
-9
lines changed Original file line number Diff line number Diff line change 1
1
import { Bird } from '../index.js' ;
2
2
import { AffricanSwallow } from '../affrican-swallow/index.js' ;
3
- import { EuropeanSwallow } from '../european-swallow/index.js' ;
4
3
import { NorwegianBlueParrot } from '../norwegian-blue-parrot/index.js' ;
5
4
6
5
export function createBird ( data ) {
7
6
switch ( data . type ) {
8
- case 'EuropeanSwallow' :
9
- return new EuropeanSwallow ( data ) ;
10
7
case 'AffricanSwallow' :
11
8
return new AffricanSwallow ( data ) ;
12
9
case 'NorwegianBlueParrot' :
Original file line number Diff line number Diff line change 1
1
import { createBird } from './index' ;
2
2
import { Bird } from '..' ;
3
- import { EuropeanSwallow } from '../european-swallow' ;
4
3
import { AffricanSwallow } from '../affrican-swallow' ;
5
4
import { NorwegianBlueParrot } from '../norwegian-blue-parrot' ;
6
5
7
6
describe ( 'createBird' , ( ) => {
8
- it ( 'should create an EuropeanSwallow' , ( ) => {
9
- const bird = createBird ( { type : 'EuropeanSwallow' } ) ;
10
- expect ( bird ) . toBeInstanceOf ( EuropeanSwallow ) ;
11
- } ) ;
12
-
13
7
it ( 'should create an AffricanSwallow' , ( ) => {
14
8
const bird = createBird ( { type : 'AffricanSwallow' } ) ;
15
9
expect ( bird ) . toBeInstanceOf ( AffricanSwallow ) ;
You can’t perform that action at this time.
0 commit comments