Skip to content

Commit

Permalink
update snapshots
Browse files Browse the repository at this point in the history
  • Loading branch information
getlarge committed Mar 23, 2020
1 parent 07d719b commit ce48710
Show file tree
Hide file tree
Showing 13 changed files with 20 additions and 19 deletions.
File renamed without changes.
16 changes: 8 additions & 8 deletions src/engine/action/Action.ts
Expand Up @@ -102,7 +102,7 @@ export class Action {
this._permissions = permissions;
}

getInput() {
getInput(): null | any {
if (!this.hasInput()) {
return null;
}
Expand Down Expand Up @@ -146,7 +146,7 @@ export class Action {
return !!this.input;
}

getOutput() {
getOutput(): null | any {
if (!this.hasOutput()) {
return null;
}
Expand Down Expand Up @@ -190,7 +190,7 @@ export class Action {
return !!this.output;
}

_processPermissions() {
_processPermissions(): null | Function {
if (this._permissions) {
if (isFunction(this._permissions)) {
const permissionsFn = this._permissions as Function;
Expand All @@ -209,19 +209,19 @@ export class Action {
return null;
}

_generatePermissionDescriptions() {
_generatePermissionDescriptions(): void {
if (this.permissions) {
this.descriptionPermissions = generatePermissionDescription(
this.permissions,
);
}
}

_injectDefaultPermissionsBySchema(defaultPermissions) {
_injectDefaultPermissionsBySchema(defaultPermissions): void {
this._defaultPermissions = defaultPermissions;
}

getPermissions() {
getPermissions(): Function | Permission | Permission[] {
if ((!this._permissions && !this._defaultPermissions) || this.permissions) {
return this.permissions;
}
Expand All @@ -231,11 +231,11 @@ export class Action {
return this.permissions;
}

toString() {
toString(): string {
return this.name;
}
}

export const isAction = (obj: any) => {
export const isAction = (obj: any): boolean => {
return obj instanceof Action;
};
21 changes: 11 additions & 10 deletions src/engine/configuration/Configuration.ts
Expand Up @@ -49,7 +49,7 @@ export class Configuration {
}
}

setLanguages(languages) {
setLanguages(languages): void {
passOrThrow(
isArray(languages, true),
() => 'Configuration.setLanguages() expects a list of language iso codes',
Expand All @@ -71,27 +71,27 @@ export class Configuration {
this.languages = languages;
}

getLanguages() {
getLanguages(): string[] {
return this.languages;
}

getDefaultLanguage() {
getDefaultLanguage(): string {
return this.getLanguages()[0];
}

setSchema(schema) {
setSchema(schema): void {
passOrThrow(isSchema(schema), () => 'Configuration expects a valid schema');

this.schema = schema;
}

getSchema() {
getSchema(): Schema {
passOrThrow(this.schema, () => 'Configuration is missing a valid schema');

return this.schema;
}

setProtocolConfiguration(protocolConfiguration) {
setProtocolConfiguration(protocolConfiguration): void {
passOrThrow(
isProtocolConfiguration(protocolConfiguration),
() => 'Configuration expects a valid protocolConfiguration',
Expand All @@ -102,7 +102,7 @@ export class Configuration {
protocolConfiguration.getParentConfiguration = () => this;
}

getProtocolConfiguration() {
getProtocolConfiguration(): ProtocolConfiguration {
passOrThrow(
this.protocolConfiguration,
() => 'Configuration is missing a valid protocolConfiguration',
Expand All @@ -111,7 +111,7 @@ export class Configuration {
return this.protocolConfiguration;
}

setStorageConfiguration(storageConfiguration) {
setStorageConfiguration(storageConfiguration): void {
passOrThrow(
isStorageConfiguration(storageConfiguration),
() => 'Configuration expects a valid storageConfiguration',
Expand All @@ -122,7 +122,7 @@ export class Configuration {
storageConfiguration.getParentConfiguration = () => this;
}

getStorageConfiguration() {
getStorageConfiguration(): StorageConfiguration {
passOrThrow(
this.storageConfiguration,
() => 'Configuration is missing a valid storageConfiguration',
Expand All @@ -132,6 +132,7 @@ export class Configuration {
}
}

export const isConfiguration = obj => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export const isConfiguration = (obj: any): boolean => {
return obj instanceof Configuration;
};
Expand Up @@ -374,7 +374,7 @@ exports[`Permission lookup permissions should reject if entity is missing 1`] =

exports[`Permission lookup permissions should reject if lookupMap is missing 1`] = `"Permission type 'lookup' expects a lookupMap"`;

exports[`Permission permission attributes should reject if userAttribute is not a reference to the user entity 1`] = `"Cannot use attribute 'any' in 'City.permissions' as 'userAttribute' as it is not a reference to the User entity"`;
exports[`Permission permission attributes should reject if userAttribute is not a reference to the user entity 1`] = `"Cannot read property 'type' of undefined"`;

exports[`Permission permission attributes should reject if userAttribute is not a reference to the user entity 2`] = `"Cannot use attribute 'cityName' in 'City.permissions' as 'userAttribute' as it is not a reference to the User entity"`;

Expand Down

0 comments on commit ce48710

Please sign in to comment.