Commit 8339604a authored by Reza Sahebgharan's avatar Reza Sahebgharan

meteor setting for jest test with meteor packages and mocking them WAD-7097

parent 37146965
let usersQueryResult = [];
export function __setUsersQueryResult(result) {
usersQueryResult = result;
}
export const Meteor = {
users: {
findOne: jest.fn().mockImplementation(() => usersQueryResult),
find: jest.fn().mockImplementation(() => ({
fetch: jest.fn().mockReturnValue(usersQueryResult),
count: jest.fn(),
})),
},
};
import { Mongo, MongoInternal } from 'meteor-jest-stubs/lib/meteor/mongo';
export { Mongo, MongoInternal };
// export const Mongo = {
// Collection: jest.fn().mockImplementation(() => ({
// _ensureIndex: (jest.fn()),
// })),
// };
\ No newline at end of file
...@@ -3,6 +3,8 @@ import AppFooter from '../client/components/AppFooter.vue'; // name of your Vue ...@@ -3,6 +3,8 @@ import AppFooter from '../client/components/AppFooter.vue'; // name of your Vue
import vuetifySetting from '../client/plugins/vuetify.js'; import vuetifySetting from '../client/plugins/vuetify.js';
import Vue from 'vue'; import Vue from 'vue';
import Vuetify from 'vuetify'; import Vuetify from 'vuetify';
import { Meteor } from 'meteor/meteor';
import { Mongo } from 'meteor/mongo';
......
...@@ -11,12 +11,6 @@ Vue.use(VueRouter); ...@@ -11,12 +11,6 @@ Vue.use(VueRouter);
import { Plugin } from 'vue-fragment' import { Plugin } from 'vue-fragment'
Vue.use(Plugin); Vue.use(Plugin);
console.log(COMMITHASH);
console.log(VERSION);
console.log(BRANCH);
import routes from './plugins/routes'; import routes from './plugins/routes';
const router = new VueRouter({ const router = new VueRouter({
mode: 'history', mode: 'history',
...@@ -27,8 +21,6 @@ import { store } from './store/store'; ...@@ -27,8 +21,6 @@ import { store } from './store/store';
import i18n from './plugins/i18n'; import i18n from './plugins/i18n';
Meteor.startup(() => { Meteor.startup(() => {
new Vue({ new Vue({
i18n, i18n,
......
...@@ -4045,7 +4045,8 @@ ...@@ -4045,7 +4045,8 @@
"harmony-reflect": { "harmony-reflect": {
"version": "1.6.1", "version": "1.6.1",
"resolved": "https://registry.npmjs.org/harmony-reflect/-/harmony-reflect-1.6.1.tgz", "resolved": "https://registry.npmjs.org/harmony-reflect/-/harmony-reflect-1.6.1.tgz",
"integrity": "sha512-WJTeyp0JzGtHcuMsi7rw2VwtkvLa+JyfEKJCFyfcS0+CDkjQ5lHPu7zEhFZP+PDSRrEgXa5Ah0l1MbgbE41XjA==" "integrity": "sha512-WJTeyp0JzGtHcuMsi7rw2VwtkvLa+JyfEKJCFyfcS0+CDkjQ5lHPu7zEhFZP+PDSRrEgXa5Ah0l1MbgbE41XjA==",
"dev": true
}, },
"has": { "has": {
"version": "1.0.3", "version": "1.0.3",
...@@ -4346,6 +4347,7 @@ ...@@ -4346,6 +4347,7 @@
"version": "3.0.0", "version": "3.0.0",
"resolved": "https://registry.npmjs.org/identity-obj-proxy/-/identity-obj-proxy-3.0.0.tgz", "resolved": "https://registry.npmjs.org/identity-obj-proxy/-/identity-obj-proxy-3.0.0.tgz",
"integrity": "sha1-lNK9qWCERT7zb7xarsN+D3nx/BQ=", "integrity": "sha1-lNK9qWCERT7zb7xarsN+D3nx/BQ=",
"dev": true,
"requires": { "requires": {
"harmony-reflect": "^1.4.6" "harmony-reflect": "^1.4.6"
} }
...@@ -6470,6 +6472,12 @@ ...@@ -6470,6 +6472,12 @@
"lodash": "^4.17.14" "lodash": "^4.17.14"
} }
}, },
"meteor-jest-stubs": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/meteor-jest-stubs/-/meteor-jest-stubs-2.0.0.tgz",
"integrity": "sha512-vDTNnUEWs22e/qRY1XCmy/DOseHHBvCzIuETa4VNmM8501IJl2kCk3A/dxd9N00ZGSOl4hcungOF6PPqoxs+iQ==",
"dev": true
},
"meteor-node-stubs": { "meteor-node-stubs": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/meteor-node-stubs/-/meteor-node-stubs-1.0.0.tgz", "resolved": "https://registry.npmjs.org/meteor-node-stubs/-/meteor-node-stubs-1.0.0.tgz",
......
...@@ -58,6 +58,7 @@ ...@@ -58,6 +58,7 @@
"less": "^3.10.3", "less": "^3.10.3",
"less-loader": "^5.0.0", "less-loader": "^5.0.0",
"material-design-icons-iconfont": "^5.0.1", "material-design-icons-iconfont": "^5.0.1",
"meteor-jest-stubs": "^2.0.0",
"sass": "^1.22.9", "sass": "^1.22.9",
"sass-loader": "^7.2.0", "sass-loader": "^7.2.0",
"uglifyjs-webpack-plugin": "^2.2.0", "uglifyjs-webpack-plugin": "^2.2.0",
...@@ -84,17 +85,20 @@ ...@@ -84,17 +85,20 @@
], ],
"moduleNameMapper": { "moduleNameMapper": {
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/__mocks__/fileMock.js", "\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/__mocks__/fileMock.js",
"\\.(css|less)$": "identity-obj-proxy" "\\.(css|less)$": "identity-obj-proxy",
"^meteor/(.*)": "<rootDir>/__mock__/.meteorMocks/index.js"
}, },
"transform": { "transform": {
"^.+\\.js$": "<rootDir>/node_modules/babel-jest", "^.+\\.js$": "<rootDir>/node_modules/babel-jest",
".*\\.(vue)$": "<rootDir>/node_modules/vue-jest" ".*\\.(vue)$": "<rootDir>/node_modules/vue-jest"
}, },
"collectCoverage": true, "collectCoverage": true,
"collectCoverageFrom": [ "collectCoverageFrom": [
"**/*.{js,vue}", "**/*.{js,vue}",
"!**/node_modules/**", "!**/node_modules/**",
"!**/coverage/**" "!**/coverage/**",
"!**/__mock__/**"
] ]
} }
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment