Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/__tests__/setup_extension.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,16 @@ describe('Extension Commands', () => {
expect(fs.existsSync('payment-ext')).toBe(true);
});

it('should expose logistics launch type with react template only', () => {
expect(Object.values(CONSTANTS.LAUNCH_TYPES)).toContain('Logistics');
expect(CONSTANTS.getTemplateChoices('Logistics')).toEqual([
'Node + React.js + SQLite',
]);
expect(CONSTANTS.getTemplateChoices('logistics')).toEqual([
'Node + React.js + SQLite',
]);
});

it('should select an existing extension', async () => {
const inquirerMock = mockFunction(inquirer.prompt);
inquirerMock
Expand Down
9 changes: 7 additions & 2 deletions src/helper/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export const TEMPLATES = {
'node-react': {
name: 'Node + React.js + SQLite',
repo: 'https://github.com/gofynd/example-extension-javascript-react',
launchTypes: ['Company', 'Application']
launchTypes: ['Company', 'Application', 'Logistics']
},
'payment-node-react': {
name: 'Node + React.js + SQLite(Payment)',
Expand All @@ -76,7 +76,8 @@ export const INIT_ACTIONS = {
export const LAUNCH_TYPES = {
COMPANY: 'Company',
APPLICATION: 'Application',
PAYMENT: 'Payment'
PAYMENT: 'Payment',
LOGISTICS: 'Logistics'
};

export function getRepoUrlForTemplate(templateName: string) {
Expand All @@ -98,6 +99,10 @@ export function getTemplateChoices(launchType: string) {
return Object.entries(TEMPLATES)
.filter(([_, template]) => template.launchTypes.some(t => t.toLowerCase() === type))
.map(([_, template]) => template.name);
} else if (type === LAUNCH_TYPES.LOGISTICS.toLowerCase()) {
return Object.entries(TEMPLATES)
.filter(([_, template]) => template.launchTypes.some(t => t.toLowerCase() === type))
.map(([_, template]) => template.name);
}
// Default to COMPANY if not matched
return Object.entries(TEMPLATES)
Expand Down
Loading