-
-
Notifications
You must be signed in to change notification settings - Fork 197
Add tests #35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+467
−16
Merged
Add tests #35
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
.DS_Store | ||
|
||
*.js | ||
!/*.js | ||
!bin/nativescript.js | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/// <reference path="../lib/.d.ts" /> | ||
/// <reference path="./definitions/mocha.d.ts" /> | ||
/// <reference path="./definitions/should.d.ts" /> | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
// Type definitions for mocha 1.17.1 | ||
// Project: http://visionmedia.github.io/mocha/ | ||
// Definitions by: Kazi Manzur Rashid <https://github.com/kazimanzurrashid/>, otiai10 <https://github.com/otiai10> | ||
// Definitions: https://github.com/borisyankov/DefinitelyTyped | ||
|
||
interface Mocha { | ||
// Setup mocha with the given setting options. | ||
setup(options: MochaSetupOptions): Mocha; | ||
|
||
//Run tests and invoke `fn()` when complete. | ||
run(callback?: () => void): void; | ||
|
||
// Set reporter as function | ||
reporter(reporter: () => void): Mocha; | ||
|
||
// Set reporter, defaults to "dot" | ||
reporter(reporter: string): Mocha; | ||
|
||
// Enable growl support. | ||
growl(): Mocha | ||
} | ||
|
||
interface MochaSetupOptions { | ||
//milliseconds to wait before considering a test slow | ||
slow?: number; | ||
|
||
// timeout in milliseconds | ||
timeout?: number; | ||
|
||
// ui name "bdd", "tdd", "exports" etc | ||
ui?: string; | ||
|
||
//array of accepted globals | ||
globals?: any[]; | ||
|
||
// reporter instance (function or string), defaults to `mocha.reporters.Dot` | ||
reporter?: any; | ||
|
||
// bail on the first test failure | ||
bail?: Boolean; | ||
|
||
// ignore global leaks | ||
ignoreLeaks?: Boolean; | ||
|
||
// grep string or regexp to filter tests with | ||
grep?: any; | ||
} | ||
|
||
interface MochaDone { | ||
(error?: Error): void; | ||
} | ||
|
||
declare var mocha: Mocha; | ||
|
||
declare var describe : { | ||
(description: string, spec: () => void): void; | ||
only(description: string, spec: () => void): void; | ||
skip(description: string, spec: () => void): void; | ||
timeout(ms: number): void; | ||
} | ||
|
||
// alias for `describe` | ||
declare var context : { | ||
(contextTitle: string, spec: () => void): void; | ||
only(contextTitle: string, spec: () => void): void; | ||
skip(contextTitle: string, spec: () => void): void; | ||
timeout(ms: number): void; | ||
} | ||
|
||
declare var it: { | ||
(expectation: string, assertion?: () => void): void; | ||
(expectation: string, assertion?: (done: MochaDone) => void): void; | ||
only(expectation: string, assertion?: () => void): void; | ||
only(expectation: string, assertion?: (done: MochaDone) => void): void; | ||
skip(expectation: string, assertion?: () => void): void; | ||
skip(expectation: string, assertion?: (done: MochaDone) => void): void; | ||
timeout(ms: number): void; | ||
}; | ||
|
||
declare function before(action: () => void): void; | ||
|
||
declare function before(action: (done: MochaDone) => void): void; | ||
|
||
declare function setup(action: () => void): void; | ||
|
||
declare function setup(action: (done: MochaDone) => void): void; | ||
|
||
declare function after(action: () => void): void; | ||
|
||
declare function after(action: (done: MochaDone) => void): void; | ||
|
||
declare function teardown(action: () => void): void; | ||
|
||
declare function teardown(action: (done: MochaDone) => void): void; | ||
|
||
declare function beforeEach(action: () => void): void; | ||
|
||
declare function beforeEach(action: (done: MochaDone) => void): void; | ||
|
||
declare function suiteSetup(action: () => void): void; | ||
|
||
declare function suiteSetup(action: (done: MochaDone) => void): void; | ||
|
||
declare function afterEach(action: () => void): void; | ||
|
||
declare function afterEach(action: (done: MochaDone) => void): void; | ||
|
||
declare function suiteTeardown(action: () => void): void; | ||
|
||
declare function suiteTeardown(action: (done: MochaDone) => void): void; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
// Type definitions for should.js 3.1.2 | ||
// Project: https://github.com/visionmedia/should.js | ||
// Definitions by: Alex Varju <https://github.com/varju/>, Maxime LUCE <https://github.com/SomaticIT/> | ||
// Definitions: https://github.com/borisyankov/DefinitelyTyped | ||
|
||
interface Object { | ||
should: ShouldAssertion; | ||
} | ||
|
||
interface ShouldAssertion { | ||
// basic grammar | ||
a: ShouldAssertion; | ||
an: ShouldAssertion; | ||
and: ShouldAssertion; | ||
be: ShouldAssertion; | ||
have: ShouldAssertion; | ||
with: ShouldAssertion; | ||
of: ShouldAssertion; | ||
not: ShouldAssertion; | ||
|
||
// validators | ||
arguments: ShouldAssertion; | ||
empty: ShouldAssertion; | ||
ok: ShouldAssertion; | ||
true: ShouldAssertion; | ||
false: ShouldAssertion; | ||
NaN: ShouldAssertion; | ||
Infinity: ShouldAssertion; | ||
Array: ShouldAssertion; | ||
Object: ShouldAssertion; | ||
String: ShouldAssertion; | ||
Boolean: ShouldAssertion; | ||
Number: ShouldAssertion; | ||
Error: ShouldAssertion; | ||
Function: ShouldAssertion; | ||
eql(expected: any, description?: string): ShouldAssertion; | ||
equal(expected: any, description?: string): ShouldAssertion; | ||
within(start: number, finish: number, description?: string): ShouldAssertion; | ||
approximately(value: number, delta: number, description?: string): ShouldAssertion; | ||
type(expected: any, description?: string): ShouldAssertion; | ||
instanceof(constructor: Function, description?: string): ShouldAssertion; | ||
above(n: number, description?: string): ShouldAssertion; | ||
below(n: number, description?: string): ShouldAssertion; | ||
match(other: {}, description?: string): ShouldAssertion; | ||
match(other: (val: any) => any, description?: string): ShouldAssertion; | ||
match(regexp: RegExp, description?: string): ShouldAssertion; | ||
match(other: any, description?: string): ShouldAssertion; | ||
matchEach(other: {}, description?: string): ShouldAssertion; | ||
matchEach(other: (val: any) => any, description?: string): ShouldAssertion; | ||
matchEach(regexp: RegExp, description?: string): ShouldAssertion; | ||
matchEach(other: any, description?: string): ShouldAssertion; | ||
length(n: number, description?: string): ShouldAssertion; | ||
property(name: string, description?: string): ShouldAssertion; | ||
property(name: string, val: any, description?: string): ShouldAssertion; | ||
properties(names: string[]): ShouldAssertion; | ||
properties(name: string): ShouldAssertion; | ||
properties(descriptor: any): ShouldAssertion; | ||
properties(...properties: string[]): ShouldAssertion; | ||
ownProperty(name: string, description?: string): ShouldAssertion; | ||
contain(obj: any): ShouldAssertion; | ||
containEql(obj: any): ShouldAssertion; | ||
containDeep(obj: any): ShouldAssertion; | ||
keys(...allKeys: string[]): ShouldAssertion; | ||
keys(allKeys: string[]): ShouldAssertion; | ||
header(field: string, val?: string): ShouldAssertion; | ||
status(code: number): ShouldAssertion; | ||
json: ShouldAssertion; | ||
html: ShouldAssertion; | ||
startWith(expected: string, message?: any): ShouldAssertion; | ||
endWith(expected: string, message?: any): ShouldAssertion; | ||
throw(message?: any): ShouldAssertion; | ||
|
||
// deprecated | ||
include(obj: any, description?: string): ShouldAssertion; | ||
includeEql(obj: any[], description?: string): ShouldAssertion; | ||
|
||
// aliases | ||
exactly(expected: any, description?: string): ShouldAssertion; | ||
instanceOf(constructor: Function, description?: string): ShouldAssertion; | ||
throwError(message?: any): ShouldAssertion; | ||
lengthOf(n: number, description?: string): ShouldAssertion; | ||
key(key: string): ShouldAssertion; | ||
haveOwnProperty(name: string, description?: string): ShouldAssertion; | ||
greaterThan(n: number, description?: string): ShouldAssertion; | ||
lessThan(n: number, description?: string): ShouldAssertion; | ||
} | ||
|
||
interface ShouldInternal { | ||
// should.js's extras | ||
exist(actual: any): void; | ||
exists(actual: any): void; | ||
not: ShouldInternal; | ||
} | ||
|
||
interface Internal extends ShouldInternal { | ||
(obj: any): ShouldAssertion; | ||
|
||
// node.js's assert functions | ||
fail(actual: any, expected: any, message: string, operator: string): void; | ||
assert(value: any, message: string): void; | ||
ok(value: any, message?: string): void; | ||
equal(actual: any, expected: any, message?: string): void; | ||
notEqual(actual: any, expected: any, message?: string): void; | ||
deepEqual(actual: any, expected: any, message?: string): void; | ||
notDeepEqual(actual: any, expected: any, message?: string): void; | ||
strictEqual(actual: any, expected: any, message?: string): void; | ||
notStrictEqual(actual: any, expected: any, message?: string): void; | ||
throws(block: any, error?: any, message?: string): void; | ||
doesNotThrow(block: any, message?: string): void; | ||
ifError(value: any): void; | ||
inspect(value: any, obj: any): any; | ||
} | ||
|
||
declare var should: Internal; | ||
|
||
declare module "should" { | ||
export = should; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/// <reference path=".d.ts" /> | ||
|
||
import PlatformServiceLib = require('../lib/services/platform-service'); | ||
import NodePackageManagerLib = require('../lib/node-package-manager'); | ||
import ProjectLib = require('../lib/services/project-service'); | ||
import stubs = require('./stubs'); | ||
|
||
import yok = require('../lib/common/yok'); | ||
|
||
require('should'); | ||
|
||
var testInjector = new yok.Yok(); | ||
testInjector.register('platformService', PlatformServiceLib.PlatformService); | ||
testInjector.register('errors', stubs.ErrorsStub); | ||
testInjector.register('fs', stubs.FileSystemStub); | ||
testInjector.register('logger', stubs.LoggerStub); | ||
testInjector.register('npm', stubs.NPMStub); | ||
testInjector.register('projectData', stubs.ProjectDataStub); | ||
testInjector.register('platformsData', stubs.PlatformsDataStub); | ||
|
||
describe('PlatformService', function(){ | ||
describe('#updatePlatforms()', function(){ | ||
it('should fail when no services provided', function(){ | ||
var platformService = testInjector.resolve('platformService'); | ||
(function(){return platformService.updatePlatforms().wait(); }).should.throw(); | ||
|
||
}) | ||
}) | ||
}); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file should be in
common
libThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The common library would have its own tests. It might use
mocha
or not.As these might differ, it's cleaner to have the
mocha
definitions here, in the upper repo. Or, have a repo for common test setup, which will be added as a submodule to each 'consumer'test
folder.