简体   繁体   中英

Placing code in the right directory for Jasmine testing + Meteor

I am new to the Jasmine testing framework and would love to get some guidance. Under the tests folder, I have the following directory structure:

tests/jasmine/client
tests/jasmine/server

Under these 2 folders, I have:

tests/jasmine/client/integration
tests/jasmine/client/unit

and

tests/jasmine/server/integration
tests/jasmine/server/unit

I am confused about the placement of code in the right folder. All my testing pertains to Meteor.methods that are (mostly) on the server. I understand that tests placed under the 'unit' testing folder have no access to any Meteor code and need stubs to be implemented, and that tests in the client folder test client code (similar for server folder). However, does this mean:

  1. All my tests for server Meteor.methods should be on server/integration?
  2. Methods that are in the /collections folder (accessible to both client and server) can be tested in either client or server?

FOLDER STRUCTURE:

both/ (OR lib/)          -- common code for server and client
  |- collections/        -- declare collections (e.g Employer = new Meteor.Collection("employer");)
  |- router     /        -- router code(e.g Router.route(..))

client/                  -- client side code
  |- global/             -- all global variable for client
  |- helpers/            -- global helper for client (for all templates)
  |- plugins/            -- all the plugins code(if you use any)
  |- stylesheets/        -- css / less files
  |- templates/          -- all templates
        |- home.html     -- home template(html)
        |- home.js       -- home template(js)

public/                  -- images/icons/fonts (meteor looking at this file)

server/                  -- server code
  |- methods/            -- server methods/API (e.g Meteor.methods({...}))
  |- publish/            -- publish code from server

Hope this may help you..

For further reference or Documentation .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM