Skip to content

Commit

Permalink
Merge pull request #458 from TAMULib/sprint22-staging
Browse files Browse the repository at this point in the history
Sprint22 staging
  • Loading branch information
jeremythuff committed Nov 1, 2021
2 parents 4933468 + ca36dcc commit 05846d9
Show file tree
Hide file tree
Showing 45 changed files with 2,811 additions and 302 deletions.
3 changes: 2 additions & 1 deletion angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@
"scripts": [],
"allowedCommonJsDependencies": [
"css-element-queries",
"handlebars"
"handlebars",
"sockjs-client"
]
},
"configurations": {
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"type": "git",
"url": "git+https://github.com/TAMULib/weaver-components.git"
},
"version": "2.0.0-rc.4",
"version": "2.0.0",
"private": false,
"license": "MIT",
"config": {
Expand Down Expand Up @@ -68,6 +68,7 @@
"@ngrx/router-store": "^12.4.0",
"@ngrx/store": "^12.4.0",
"@ngrx/store-devtools": "^12.4.0",
"@stomp/stompjs": "^6.1.2",
"@tinymce/tinymce-angular": "^4.2.4",
"@ungap/custom-elements": "^1.0.0",
"bootstrap": "^4.6.0",
Expand All @@ -76,6 +77,7 @@
"json5": "^2.2.0",
"ng-inline-svg": "^13.0.0",
"rxjs": "~6.6.7",
"sockjs-client": "^1.5.2",
"tinymce": "^5.9.2",
"tslib": "^2.3.1",
"web-animations-js": "^2.3.2",
Expand Down
2 changes: 1 addition & 1 deletion projects/wvr-elements/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@wvr/elements",
"version": "2.0.0-rc.4",
"version": "2.0.0",
"description": "Collection of angular components for Weaver's Custom Web Component UI",
"author": "Texas A&M University Libraries",
"private": false,
Expand Down
4 changes: 3 additions & 1 deletion projects/wvr-elements/src/lib/core/actions.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as Manifest from './manifest/manifest.actions';
import * as Layout from './layout/layout.actions';
import * as Manifest from './manifest/manifest.actions';
import * as MessageManifest from './message-manifest/message-manifest.actions';
import * as Modal from './modal/modal.actions';
import * as Rest from './rest/rest.actions';
import * as Theme from './theme/theme.actions';
Expand All @@ -8,6 +9,7 @@ import * as Wysiwyg from './wysiwyg/wysiwyg.actions';
export const actions = {
Layout,
Manifest,
MessageManifest,
Modal,
Rest,
Theme,
Expand Down
2 changes: 2 additions & 0 deletions projects/wvr-elements/src/lib/core/effects.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { ManifestEffects as Manifest } from './manifest/manifest.effects';
import { MessageManifestEffects as MessageManifest } from './message-manifest/message-manifest.effects';
import { ModalEffects as Modal } from './modal/modal.effects';
import { RestEffects as Rest } from './rest/rest.effects';
import { ThemeEffects as Theme } from './theme/theme.effects';
import { WysiwygEffects as Wysiwyg } from './wysiwyg/wysiwyg.effects';

export const effects = {
Manifest,
MessageManifest,
Modal,
Rest,
Theme,
Expand Down
151 changes: 151 additions & 0 deletions projects/wvr-elements/src/lib/core/manifest/manifest.actions.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
import { Predicate, Update } from '@ngrx/entity';
import { Manifest } from './manifest';
import { ManifestEntry } from './manifest-entry';
import * as fromManifestReducers from './manifest.reducers';
import * as fromManifestActions from './manifest.actions';

describe('Manifest Reducer', () => {
let entry1: ManifestEntry;
let entry2: ManifestEntry;
let entry3: ManifestEntry;
let manifest: Manifest;
let manifests: Array<Manifest>;
let update: Update<Manifest>;
let updates: Array<Update<Manifest>>;
let state: any;
let predicate: Predicate<Manifest>;

beforeEach(() => {
entry1 = {
name: 'All Sorted',
path: '/ldap/all-sorted',
methods: [ 'GET' ]
};

entry2 = {
name: 'Departments',
path: '/ldap/departments',
methods: [ 'GET' ]
};

entry3 = {
name: 'Other',
path: '/other',
methods: [ 'GET' ]
};

manifest = {
name: 'Directory App',
baseUrl: 'https://api-dev.library.tamu.edu/directory-service',
entries: [ entry1, entry2 ]
};

manifests = [
manifest, {
...manifest,
name: manifest.name + ' 2',
entries: [ entry3 ]
}
];

state = {
ids: [],
entities: {},
pendingRequests: [],
currentRequest: undefined
};

update = {
id: JSON.stringify(fromManifestReducers.adapter.selectId),
changes: { name: manifest.name + ' updated' }
};

updates = [
update, {
...update,
changes: {
name: manifest.name + ' updated 2'
}
}
];

predicate = (entity): boolean => {
return entity.baseUrl === manifest.baseUrl;
};
});

it('should have manifest action type as "[Manifest] Add Manifest"', () => {
const action = fromManifestActions.addManifest({ manifest });
expect(action.type === '[Manifest] Add Manifest')
.toBe(true);
});

it('should have manifest action type as "[Manifest] Add Manifests"', () => {
const action = fromManifestActions.addManifests({ manifests });
expect(action.type === '[Manifest] Add Manifests')
.toBe(true);
});

it('should have manifest action type as "[Manifest] Clear Manifests"', () => {
const action = fromManifestActions.clearManifests();
expect(action.type === '[Manifest] Clear Manifests')
.toBe(true);
});

it('should have manifest action type as "[Manifest] Delete Manifest"', () => {
const action = fromManifestActions.deleteManifest({ id: manifest.name });
expect(action.type === '[Manifest] Delete Manifest')
.toBe(true);
});

it('should have manifest action type as "[Manifest] Delete Manifests"', () => {
const action = fromManifestActions.deleteManifests({ ids: [ manifest.name, manifest.name + ' 2' ] });
expect(action.type === '[Manifest] Delete Manifests')
.toBe(true);
});

it('should have manifest action type as "[Manifest] Delete Manifests By Predicate"', () => {
const action = fromManifestActions.deleteManifestsByPredicate({ predicate });
expect(action.type === '[Manifest] Delete Manifests By Predicate')
.toBe(true);
});

it('should have manifest action type as "[Manifest] Load Manifests"', () => {
const action = fromManifestActions.loadManifests({ manifests });
expect(action.type === '[Manifest] Load Manifests')
.toBe(true);
});

it('should have manifest action type as "[Manifest] Set Manifest"', () => {
const action = fromManifestActions.setManifest({ manifest });
expect( action.type === '[Manifest] Set Manifest' )
.toBe(true);
});

it('should have manifest action type as "[Manifest] Update Manifest"', () => {
const action = fromManifestActions.updateManifest({ update });
expect( action.type === '[Manifest] Update Manifest' )
.toBe(true);
});

it('should have manifest action type as "[Manifest] Update Manifests"', () => {
const action = fromManifestActions.updateManifests({ updates });
expect( action.type === '[Manifest] Update Manifests' )
.toBe(true);
});

it('should have manifest action type as "[Manifest] Upsert Manifest"', () => {
const action = fromManifestActions.upsertManifest({ manifest });
expect( action.type === '[Manifest] Upsert Manifest' )
.toBe(true);
});

it('should have manifest action type as "[Manifest] Upsert Manifests"', () => {
const action = fromManifestActions.upsertManifests({ manifests });
expect(action.type === '[Manifest] Upsert Manifests')
.toBe(true);
});

// TODO entity MapManifests, Issue #294.

});

0 comments on commit 05846d9

Please sign in to comment.