Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(unit-tests): implemented and integrated #37

Merged
merged 2 commits into from
Feb 16, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
23 changes: 23 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Test

on: [pull_request]

jobs:
lint:
name: Run tests
runs-on: ubuntu-latest

steps:
- name: Check out Git repository
uses: actions/checkout@v2

- name: Set up Node.js
uses: actions/setup-node@v1
with:
node-version: 12

- name: Install dependencies
run: npm ci

- name: Unit/Integration tests
run: npm run test
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,6 @@ dist
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*

# reports of jest tests
reports
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

enter

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIIIIICE, it's .gitignore after all :)
Fixing

3 changes: 3 additions & 0 deletions src/models/layerMetadata/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
export * from './layerMetadata';
export * from './layerMetadata-StatusFields';

export { IShpMapping } from './decorators/shp.decorator';
export { IPYCSWMapping } from './decorators/csw.decorator';
51 changes: 51 additions & 0 deletions tests/unit/layerMetadata.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import { LayerMetadata, IPYCSWMapping, IShpMapping, IPropPYCSWMapping, IPropSHPMapping } from '../../src/models';

describe('LayerMetadata class static methods', () => {
it('getPyCSWMapping(): mapped to PYCSW prop', () => {
const PROPERTY_NAME = 'geometry';
const pycswMapping: IPYCSWMapping | undefined = LayerMetadata.getPyCSWMapping(PROPERTY_NAME);

expect(pycswMapping).toHaveProperty('xmlElement');
expect(pycswMapping).toHaveProperty('queryableField');
});

it('getPyCSWMapping(): NOT mapped to PYCSW prop', () => {
const PROPERTY_NAME = 'dummy_geometry';
const pycswMapping: IPYCSWMapping | undefined = LayerMetadata.getPyCSWMapping(PROPERTY_NAME);

expect(pycswMapping).toBeUndefined();
});

it('getShpMapping(): mapped to SHAPE prop', () => {
const PROPERTY_NAME = 'geometry';
const shpMapping: IShpMapping | undefined = LayerMetadata.getShpMapping(PROPERTY_NAME);

expect(shpMapping).toHaveProperty('shpFile');
expect(shpMapping).toHaveProperty('valuePath');
});

it('getShpMapping(): NOT mapped to SHAPE prop', () => {
const PROPERTY_NAME = 'dummy_geometry';
const shpMapping: IShpMapping | undefined = LayerMetadata.getShpMapping(PROPERTY_NAME);

expect(shpMapping).toBeUndefined();
});

it('getPyCSWMappings(): HAS props mapped to PYCSW', () => {
const pycswMappings: IPropPYCSWMapping[] = LayerMetadata.getPyCSWMappings();

expect(pycswMappings.length).toBeGreaterThan(0);
expect(pycswMappings[0]).toHaveProperty('prop');
expect(pycswMappings[0]).toHaveProperty('xmlElement');
expect(pycswMappings[0]).toHaveProperty('queryableField');
});

it('getShpMappings(): HAS props mapped to SHAPE', () => {
const shpMappings: IPropSHPMapping[] = LayerMetadata.getShpMappings();

expect(shpMappings.length).toBeGreaterThan(0);
expect(shpMappings[0]).toHaveProperty('prop');
expect(shpMappings[0]).toHaveProperty('shpFile');
expect(shpMappings[0]).toHaveProperty('valuePath');
});
});
11 changes: 0 additions & 11 deletions tests/unit/some-test.spec.ts

This file was deleted.