Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add some extra test around stackblitz services
- Loading branch information
1 parent
275a679
commit edb3253
Showing
4 changed files
with
144 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
packages/xlayers/src/app/editor/exports/stackblitz/stackblitz.angular.service.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { XlayersNgxEditorModel } from '@app/editor/code-editor/editor-container/codegen/codegen.service'; | ||
import { ExportStackblitzAngularService } from './stackblitz.angular.service'; | ||
|
||
describe('StackBlitz Angular', () => { | ||
let service: ExportStackblitzAngularService; | ||
let files, template, tags; | ||
const model: XlayersNgxEditorModel = { | ||
kind: 'angular', | ||
uri: 'uri', | ||
value: 'string', | ||
language: 'angular' | ||
}; | ||
beforeEach(() => { | ||
service = new ExportStackblitzAngularService(); | ||
const result = service.prepare([model]); | ||
files = result.files; | ||
tags = result.tags; | ||
template = result.template; | ||
}); | ||
|
||
it('should be created', () => { | ||
expect(service).toBeTruthy(); | ||
}); | ||
|
||
it('should contain 5 files', () => { | ||
expect(Object.keys(files).length).toBe(5); | ||
}); | ||
|
||
|
||
it('should contain a app.component', () => { | ||
expect(files['src/app/app.component.ts']).toBeTruthy(); | ||
}); | ||
|
||
it('should contain uri files', () => { | ||
expect(files['src/app/xlayers/uri']).toBe('string'); | ||
}); | ||
|
||
it('should have default index.html', () => { | ||
expect(files['src/index.html']).toBe('<my-app>loading</my-app>'); | ||
}); | ||
|
||
it('should have angular tag', () => { | ||
expect(tags).toEqual(['angular']); | ||
}); | ||
|
||
it('should have angular-cli template', () => { | ||
expect(template).toBe('angular-cli'); | ||
}); | ||
}); |
45 changes: 45 additions & 0 deletions
45
packages/xlayers/src/app/editor/exports/stackblitz/stackblitz.lit-element.service.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { XlayersNgxEditorModel } from '@app/editor/code-editor/editor-container/codegen/codegen.service'; | ||
import { ExportStackblitzLitElementService } from './stackblitz.lit-element.service'; | ||
|
||
describe('StackBlitz Lit Element', () => { | ||
let service: ExportStackblitzLitElementService; | ||
let files, template, tags; | ||
const model: XlayersNgxEditorModel = { | ||
kind: 'litElement', | ||
uri: 'uri', | ||
value: 'string', | ||
language: 'lit' | ||
}; | ||
|
||
beforeEach(() => { | ||
service = new ExportStackblitzLitElementService(); | ||
const result = service.prepare([model]); | ||
files = result.files; | ||
tags = result.tags; | ||
template = result.template; | ||
}); | ||
|
||
it('should be created', () => { | ||
expect(service).toBeTruthy(); | ||
}); | ||
|
||
it('should contain 3 files', () => { | ||
expect(Object.keys(files).length).toBe(3); | ||
}); | ||
|
||
it('should contain uri files', () => { | ||
expect(files['uri']).toBe('string'); | ||
}); | ||
|
||
it('should have default index.js', () => { | ||
expect(files['index.js']).toBe(`import './x-layers-element.js';`); | ||
}); | ||
|
||
it('should have web component and lit-element tag', () => { | ||
expect(tags).toEqual(['web component', 'lit-element']); | ||
}); | ||
|
||
it('should have javascript template', () => { | ||
expect(template).toBe('javascript'); | ||
}); | ||
}); |
49 changes: 49 additions & 0 deletions
49
packages/xlayers/src/app/editor/exports/stackblitz/stackblitz.react.service.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { XlayersNgxEditorModel } from '@app/editor/code-editor/editor-container/codegen/codegen.service'; | ||
import { ExportStackblitzReactService } from './stackblitz.react.service'; | ||
|
||
describe('StackBlitz React', () => { | ||
let service: ExportStackblitzReactService; | ||
let files, template, tags; | ||
const model: XlayersNgxEditorModel = { | ||
kind: 'react', | ||
uri: 'uri', | ||
value: 'string', | ||
language: 'react' | ||
}; | ||
beforeEach(() => { | ||
service = new ExportStackblitzReactService(); | ||
const result = service.prepare([model]); | ||
files = result.files; | ||
tags = result.tags; | ||
template = result.template; | ||
}); | ||
|
||
it('should be created', () => { | ||
expect(service).toBeTruthy(); | ||
}); | ||
|
||
it('should contain 4 files', () => { | ||
expect(Object.keys(files).length).toBe(4); | ||
}); | ||
|
||
|
||
it('should have default index file', () => { | ||
expect(files['src/index.js']).toBeTruthy(); | ||
}); | ||
|
||
it('should contain uri files', () => { | ||
expect(files['src/uri']).toBe('string'); | ||
}); | ||
|
||
it('should have default index.html', () => { | ||
expect(files['public/index.html']).toBeTruthy(); | ||
}); | ||
|
||
it('should have react tag', () => { | ||
expect(tags).toEqual(['react']); | ||
}); | ||
|
||
it('should have create-react-app template', () => { | ||
expect(template).toBe('create-react-app'); | ||
}); | ||
}); |