Skip to content

An example that illustrates how to unit test an AMD code base using grunt-castle

License

Notifications You must be signed in to change notification settings

jstrimpel/grunt-castle-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Grunt-castle Example

This is a simple example of how to use grunt-castle to unit test a client-server AMD code base.

In case you are wondering what the names in this example are referencing, "The Sneetches".

Overview

In this example the fictitious application resides in the lib directory. The lib/modules directory represents code that was imported from another project. This imported code is used to highlight a case for mocking dependencies.

The test/mocks directory contains the testing mocks. Grunt-castle supports two types of mocks, AMD and global. money.js is a global mock, which is referenced in the application code. test/mocks/modules/sylvesterMcMonkeyMcBean.js mocks the application file lib/modules/sylvesterMcMonkeyMcBean.js.

The test/specs directory contains the specifications to be tested. In this example there is only 1 specification, test/specs/shared/sneetch.js. This specification will be tested on both the client and the server.

The grunt-castle task configuration for this example can be found in Gruntfile.js.

For further information about grunt-castle visit the Github repo.

Getting Started

First clone the repo:

git clone [email protected]:jstrimpel/grunt-castle-example.git

Second install the dependencies from the local repo directory:

npm install

Third run the tests:

grunt castle

You are done.

About

An example that illustrates how to unit test an AMD code base using grunt-castle

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published