aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjw2552018-04-19 21:10:18 +0100
committerjw2552018-04-19 21:10:18 +0100
commitb8ed41883fb0b9faf2733632657243c7dece4d6e (patch)
tree0d8097e066a927287ce80d4f4b5a6cfc64ca1ebd
parentfixed test-crash (diff)
downloadmedicine-b8ed41883fb0b9faf2733632657243c7dece4d6e.tar.gz
medicine-b8ed41883fb0b9faf2733632657243c7dece4d6e.zip

reduced # of failing tests

-rw-r--r--src/FileRouter.ts8
-rw-r--r--src/logger.ts6
-rw-r--r--src/matcher/options.ts13
-rw-r--r--test/integration/protocol.routes.test.ts32
4 files changed, 27 insertions, 32 deletions
diff --git a/src/FileRouter.ts b/src/FileRouter.ts
index 53fc537..3f966c2 100644
--- a/src/FileRouter.ts
+++ b/src/FileRouter.ts
@@ -168,7 +168,7 @@ const getProperties: Middleware = (
const postProperties: Middleware = (
req: Request, res: Response, next: NextFunction
): void => {
- logger.debug('Editing server properties');
+ console.log('Editing server properties');
res.locals.modified = true;
for (const newProp of req.body) {
const prop: Property | undefined = serverConfig.find(
@@ -189,6 +189,7 @@ const postProperties: Middleware = (
return;
}
}
+ console.log("Posted Properties successfully");
next();
};
@@ -629,7 +630,8 @@ const postFilePath: Middleware = async(req: Request, res: Response, next: NextFu
// Sets final if requested
if (res.locals.file && qH.isFinal(req)) {
- res.locals.file.status = 'final';
+ res.locals.file.status = 'preprocessing';
+ // start file conversion
}
// Sets Metadata if requested
@@ -767,7 +769,7 @@ export class FileRouter {
// File access
this.router.get ('/projects/:project_name/files/:path', getFilePath);
this.router.post('/projects/:project_name/files/:path',
- upload.single('userfile'), postFilePath);
+ upload.single('userfile'), postFilePath);
this.router.get ('/projects/:project_name/files_by_id/:id', getFileId);
}
diff --git a/src/logger.ts b/src/logger.ts
index ba66650..bdd8fbc 100644
--- a/src/logger.ts
+++ b/src/logger.ts
@@ -143,7 +143,7 @@ const basicFileTransport: winston.TransportInstance =
silent: false,
colorize: false,
timestamp: true,
- filename: './logs/general/basic',//logPath('basic'),
+ filename: './logs/general/basic', //logPath('basic'),
maxSize: 1000000,
maxFiles: 100,
stream: undefined,
@@ -170,7 +170,7 @@ const criticalFileTransport: winston.TransportInstance =
silent: false,
colorize: false,
timestamp: true,
- filename: './logs/general/critical' ,//logPath('critical'),
+ filename: './logs/general/critical', //logPath('critical'),
maxSize: 1000000,
maxFiles: 10,
stream: undefined,
@@ -198,7 +198,7 @@ const queryFileTransport: winston.TransportInstance =
silent: false,
colorize: false,
timestamp: true,
- filename: './logs/general/queries',//logPath('queries'),
+ filename: './logs/general/queries', //logPath('queries'),
maxSize: 1000000,
maxFiles: 100,
stream: undefined,
diff --git a/src/matcher/options.ts b/src/matcher/options.ts
index 967a6f9..62e4985 100644
--- a/src/matcher/options.ts
+++ b/src/matcher/options.ts
@@ -15,20 +15,13 @@ export type Value =
const matchNoCurry:
(template: TemplateValue, value: Value | undefined) => boolean =
(template: TemplateValue, value: Value | undefined): boolean => {
- console.log("matchNoCurry()")
- console.log(template)
- console.log(value)
if (types.atom(template)) {
- console.log("atom")
return template === value;
} else if (types.function(template)) {
- console.log("function")
return template(value);
} else if (types.atom(value) || value === undefined) {
- console.log("atom2")
return false;
} else if (types.object(template)) {
- console.log("object")
return Object.keys(template)
.every((key: string): boolean => {
const v: Value | undefined = value[key];
@@ -41,11 +34,7 @@ const matchNoCurry:
// tslint:disable-next-line:typedef
export const match = (template: TemplateValue, value?: Value) => {
- console.log("match()")
- console.log(template)
- console.log(value)
if (value === undefined) {
- console.log("is undefined")
return matchNoCurry.bind(null, template);
}
return matchNoCurry(template, value);
@@ -96,7 +85,7 @@ export const array = (template: TemplateValue, values?: Value[]) => {
const m: Checker = types.function(template)
? template
: match.bind(null, template);
- return values.every(m); //
+ return values.every(m);
};
// tslint:disable-next-line:typedef
diff --git a/test/integration/protocol.routes.test.ts b/test/integration/protocol.routes.test.ts
index 1e8bf63..a371fd5 100644
--- a/test/integration/protocol.routes.test.ts
+++ b/test/integration/protocol.routes.test.ts
@@ -94,16 +94,19 @@ const completeProtocol: MochaForEachInput[] = [
required: array(types.string)
}, 200],
['get', '/log', array({
+ user: optional(types.string),
component: types.string,
level: alternative([
+ 'debug',
'info',
'security',
'warning',
'error',
- 'critical'
+ 'critical',
+ 'success'
]),
- value: types.anything,
- username: types.string,
+ message: types.anything,
+ label: optional(types.string),
timestamp: types.string
}), 200],
['post', '/log', [{
@@ -116,22 +119,23 @@ const completeProtocol: MochaForEachInput[] = [
display: optional(match({
category: types.string,
group: types.string,
- display_name: types.string,
+ displayName: types.string,
description: types.string
})),
- read_only: types.boolean,
+ readOnly: types.boolean,
type: alternative([
'string',
'integer',
'boolean'
]),
- value: alternative([
+ valueInternal: alternative([
types.string,
types.integer,
types.boolean
])
}), 200],
- ['post', '/properties?action=update', null, 200],
+ ['post', '/properties?action=update',
+ [{id: 'new_prop', value: 'some_value'}], 200],
['get', '/user_privileges', array({
privilege: types.string,
description: types.string,
@@ -139,8 +143,8 @@ const completeProtocol: MochaForEachInput[] = [
}), 200],
['get', '/users', array({
username: types.string,
- privileges: types.array(types.string),
- projects: types.array({
+ privileges: array(types.string),
+ projects: array({
project_name: types.string,
access_level: types.string
}),
@@ -168,8 +172,8 @@ const completeProtocol: MochaForEachInput[] = [
}, 200],
['get', '/current_user', {
username: types.string,
- privileges: types.array(types.string),
- projects: types.array({
+ privileges: array(types.string),
+ projects: array({
project_name: types.string,
access_level: types.string
}),
@@ -186,7 +190,7 @@ const completeProtocol: MochaForEachInput[] = [
}), 200],
['get', '/projects', array({
project_name: types.string,
- users: types.array({
+ users: array({
username: types.string,
access_level: types.string
}),
@@ -206,8 +210,8 @@ const completeProtocol: MochaForEachInput[] = [
}, 200],
['post', '/projects/mocky', null, 200],
['get', '/projects/mocky/properties', null, 200],
- ['get', '/projects/mocky/files/example/path', null, 200],
- ['post', '/projects/mocky/files/some_file?action=overwrite', {}, 200],
+ ['post', '/projects/mocky/files/folder+some_file?action=overwrite', {}, 200],
+ ['get', '/projects/mocky/files/folder+some_file', null, 200],
['get', '/projects/mocky/files_by_id/file1', null, 200]
];