ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anovi...@apache.org
Subject [39/50] [abbrv] ignite git commit: ignite-3629 Integrated mockgoose for mocking mongo db layer.
Date Thu, 08 Sep 2016 04:46:56 GMT
ignite-3629 Integrated mockgoose for mocking mongo db layer.


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/0580bbf4
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/0580bbf4
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/0580bbf4

Branch: refs/heads/ignite-3629
Commit: 0580bbf45e3248fc7a74d2b09727975b44d9de54
Parents: 5330ed8
Author: Maxim Afanasiev <mafkus@gmail.com>
Authored: Mon Sep 5 23:05:53 2016 +0700
Committer: Maxim Afanasiev <mafkus@gmail.com>
Committed: Mon Sep 5 23:05:53 2016 +0700

----------------------------------------------------------------------
 modules/web-console/backend/app/mongo.js        |  2 +-
 modules/web-console/backend/app/mongoose.js     | 31 ++++++++++++++++++
 .../backend/test/fixtures/mockgoose.js          | 34 ++++++++++++++++++++
 modules/web-console/backend/test/injector.js    |  6 ++--
 4 files changed, 70 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/0580bbf4/modules/web-console/backend/app/mongo.js
----------------------------------------------------------------------
diff --git a/modules/web-console/backend/app/mongo.js b/modules/web-console/backend/app/mongo.js
index 7fe39f0..640cece 100644
--- a/modules/web-console/backend/app/mongo.js
+++ b/modules/web-console/backend/app/mongo.js
@@ -24,7 +24,7 @@
  */
 module.exports = {
     implements: 'mongo',
-    inject: ['require(passport-local-mongoose)', 'settings', 'ignite_modules/mongo:*', 'require(mongoose)']
+    inject: ['require(passport-local-mongoose)', 'settings', 'ignite_modules/mongo:*', 'mongoose']
 };
 
 module.exports.factory = function(passportMongo, settings, pluginMongo, mongoose) {

http://git-wip-us.apache.org/repos/asf/ignite/blob/0580bbf4/modules/web-console/backend/app/mongoose.js
----------------------------------------------------------------------
diff --git a/modules/web-console/backend/app/mongoose.js b/modules/web-console/backend/app/mongoose.js
new file mode 100644
index 0000000..5dba51d
--- /dev/null
+++ b/modules/web-console/backend/app/mongoose.js
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+'use strict';
+
+// Fire me up!
+
+module.exports = {
+    implements: 'mongoose',
+    inject: ['require(mongoose)']
+};
+
+
+module.exports.factory = (mongoose) => {
+    return mongoose;
+};
+

http://git-wip-us.apache.org/repos/asf/ignite/blob/0580bbf4/modules/web-console/backend/test/fixtures/mockgoose.js
----------------------------------------------------------------------
diff --git a/modules/web-console/backend/test/fixtures/mockgoose.js b/modules/web-console/backend/test/fixtures/mockgoose.js
new file mode 100644
index 0000000..84eb088
--- /dev/null
+++ b/modules/web-console/backend/test/fixtures/mockgoose.js
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+'use strict';
+
+// Fire me up!
+
+module.exports = {
+    implements: 'mongoose:mock',
+    inject: ['mongoose', 'require(mockgoose)']
+};
+
+
+module.exports.factory = (mongoose, mockgoose) => {
+    return new Promise((resolve) => {
+        mockgoose(mongoose).then(() => resolve(mongoose));
+    });
+};
+
+

http://git-wip-us.apache.org/repos/asf/ignite/blob/0580bbf4/modules/web-console/backend/test/injector.js
----------------------------------------------------------------------
diff --git a/modules/web-console/backend/test/injector.js b/modules/web-console/backend/test/injector.js
index 8d44d31..3cec9d6 100644
--- a/modules/web-console/backend/test/injector.js
+++ b/modules/web-console/backend/test/injector.js
@@ -26,6 +26,8 @@ module.exports = fireUp.newInjector({
         './errors/**/*.js',
         './middlewares/**/*.js',
         './routes/**/*.js',
-        './services/**/*.js'
-    ]
+        './services/**/*.js',
+        './test/fixtures/*.js'
+    ],
+    use: ['mongoose:mock']
 });


Mime
View raw message