src/app/tests/mocks/group-route.ts
A service for group route.
Properties |
Methods |
constructor()
|
Defined in src/app/tests/mocks/group-route.ts:11
|
create | ||||||||
create(args: )
|
||||||||
Defined in src/app/tests/mocks/group-route.ts:16
|
||||||||
Parameters :
Returns :
string
|
group | ||||||||
group(name: )
|
||||||||
Defined in src/app/tests/mocks/group-route.ts:38
|
||||||||
Parameters :
Returns :
any
|
isSimilar | ||||||||
isSimilar(str: string)
|
||||||||
Defined in src/app/tests/mocks/group-route.ts:26
|
||||||||
Parameters :
Returns :
boolean
|
Private _group |
_group:
|
Defined in src/app/tests/mocks/group-route.ts:11
|
Public last |
last:
|
Defined in src/app/tests/mocks/group-route.ts:10
|
import * as uuidv4 from 'uuid/v4';
/**
* A service for group route.
*
* @author Damien Vitrac
*/
export class MockGroupRouteService {
public last = null;
private _group = {};
constructor() {
}
create(args): string {
const key = 'group-' + uuidv4();
this._group[key] = args;
this.last = {
key: key,
args: args
};
return key;
}
isSimilar(str: string): boolean {
str = str || '';
if (!str.startsWith('group-')) {
return false;
}
const g = `group-`.length;
if (str.length !== (36 + g) || str[(8 + g)] !== '-' || str[(13 + g)] !== '-' || str[(18 + g)] !== '-' || str[(23 + g)] !== '-') {
return false;
}
return true;
}
group(name) {
return this._group[name];
}
}