Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
Moecube Store
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
Moecube Store
Commits
7a268b5a
Commit
7a268b5a
authored
Apr 26, 2016
by
Ward Bell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: update tests and test support for beta.16
parent
74af5aab
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
64 additions
and
45 deletions
+64
-45
CHANGELOG.md
CHANGELOG.md
+6
-1
app/app.component.spec.ts
app/app.component.spec.ts
+17
-22
karma.conf.js
karma.conf.js
+27
-18
wallaby.js
wallaby.js
+14
-4
No files found.
CHANGELOG.md
View file @
7a268b5a
...
...
@@ -9,7 +9,12 @@
*
added favicon.ico
<a
name=
"0.1.15"
></a>
*
testing
-
updated wallaby.js and karma.conf.js
-
updated app.component.spec.ts
<a
name=
"0.1.15"
></a>
# 0.1.15 (2016-04-13)
*
Add testing support
*
npm scripts
...
...
app/app.component.spec.ts
View file @
7a268b5a
...
...
@@ -5,7 +5,7 @@ import {
expect
,
it
,
iit
,
xit
,
describe
,
ddescribe
,
xdescribe
,
beforeEach
,
beforeEachProviders
,
withProviders
,
inject
,
injectAsync
,
TestComponentBuilder
async
,
inject
,
TestComponentBuilder
}
from
'
angular2/testing
'
;
import
{
By
}
from
'
angular2/platform/browser
'
;
...
...
@@ -13,11 +13,6 @@ import { provide } from 'angular2/core';
import
{
ViewMetadata
}
from
'
angular2/core
'
;
import
{
PromiseWrapper
}
from
'
angular2/src/facade/promise
'
;
interface
Done
{
():
void
;
fail
:
(
err
:
any
)
=>
void
;
}
//////// SPECS /////////////
/// Delete this
...
...
@@ -28,33 +23,33 @@ describe('Smoke test', () => {
});
describe
(
'
AppComponent with new
'
,
function
()
{
it
(
'
should instantiate component
'
,
()
=>
{
expect
(
new
AppComponent
()).
not
.
toBeNull
(
'
Whoopie!
'
);
});
it
(
'
should instantiate component
'
,
()
=>
{
expect
(
new
AppComponent
()).
toBeDefined
(
'
Whoopie!
'
);
});
});
describe
(
'
AppComponent with TCB
'
,
function
()
{
it
(
'
should instantiate component
'
,
injectAsync
([
TestComponentBuilder
],
(
tcb
:
TestComponentBuilder
)
=>
{
async
(
inject
([
TestComponentBuilder
],
(
tcb
:
TestComponentBuilder
)
=>
{
return
tcb
.
createAsync
(
AppComponent
).
then
(
fixture
=>
{
expect
(
fixture
.
componentInstance
instanceof
AppComponent
).
toBe
(
true
,
'
should create AppComponent
'
);
});
}
));
tcb
.
createAsync
(
AppComponent
).
then
(
fixture
=>
{
expect
(
fixture
.
componentInstance
instanceof
AppComponent
).
toBe
(
true
,
'
should create AppComponent
'
);
});
})
));
it
(
'
should have expected <h1> text
'
,
injectAsync
([
TestComponentBuilder
],
(
tcb
:
TestComponentBuilder
)
=>
{
async
(
inject
([
TestComponentBuilder
],
(
tcb
:
TestComponentBuilder
)
=>
{
return
tcb
.
createAsync
(
AppComponent
).
then
(
fixture
=>
{
// fixture.detectChanges(); // needed for a binding;
we don't have a binding
tcb
.
createAsync
(
AppComponent
).
then
(
fixture
=>
{
// fixture.detectChanges(); // would need to resolve a binding but
we don't have a binding
let
h1
=
fixture
.
debugElement
.
query
(
el
=>
el
.
name
===
'
h1
'
).
nativeElement
;
// it works
let
h1
=
fixture
.
debugElement
.
query
(
el
=>
el
.
name
===
'
h1
'
).
nativeElement
;
// it works
h1
=
fixture
.
debugElement
.
query
(
By
.
css
(
'
h1
'
)).
nativeElement
;
// preferred
h1
=
fixture
.
debugElement
.
query
(
By
.
css
(
'
h1
'
)).
nativeElement
;
// preferred
expect
(
h1
.
innerText
).
toMatch
(
/angular 2 app/i
,
'
<h1> should say something about "Angular 2 App"
'
);
});
expect
(
h1
.
innerText
).
toMatch
(
/angular 2 app/i
,
'
<h1> should say something about "Angular 2 App"
'
);
});
}
));
})
));
});
karma.conf.js
View file @
7a268b5a
module
.
exports
=
function
(
config
)
{
var
appBase
=
'
app/
'
;
// transpiled app JS files
var
appAssets
=
'
base/app/
'
;
// component assets fetched by Angular's compiler
var
appAssets
=
'
/
base/app/
'
;
// component assets fetched by Angular's compiler
config
.
set
({
basePath
:
''
,
...
...
@@ -20,23 +20,32 @@ module.exports = function(config) {
flags
:
[
'
--no-sandbox
'
]
}
},
files
:
[
// Angular and shim libraries loaded by Karma
{
pattern
:
'
node_modules/systemjs/dist/system.src.js
'
,
included
:
true
,
watched
:
true
},
{
pattern
:
'
node_modules/es6-shim/es6-shim.js
'
,
included
:
true
,
watched
:
true
},
{
pattern
:
'
node_modules/angular2/bundles/angular2-polyfills.js
'
,
included
:
true
,
watched
:
true
},
{
pattern
:
'
node_modules/rxjs/bundles/Rx.js
'
,
included
:
true
,
watched
:
true
},
{
pattern
:
'
node_modules/angular2/bundles/angular2.js
'
,
included
:
true
,
watched
:
true
},
{
pattern
:
'
node_modules/angular2/bundles/testing.dev.js
'
,
included
:
true
,
watched
:
true
},
// External libraries loaded by Karma
{
pattern
:
'
node_modules/angular2/bundles/http.dev.js
'
,
included
:
true
,
watched
:
true
},
{
pattern
:
'
node_modules/angular2/bundles/router.dev.js
'
,
included
:
true
,
watched
:
true
},
{
pattern
:
'
node_modules/a2-in-memory-web-api/web-api.js
'
,
included
:
true
,
watched
:
true
},
// Configures module loader w/ app and specs, then launch karma
{
pattern
:
'
karma-test-shim.js
'
,
included
:
true
,
watched
:
true
},
// System.js for module loading
'
node_modules/systemjs/dist/system-polyfills.js
'
,
'
node_modules/systemjs/dist/system.src.js
'
,
// Polyfills
'
node_modules/es6-shim/es6-shim.js
'
,
'
node_modules/angular2/bundles/angular2-polyfills.js
'
,
// Zone.js dependencies
// Note - do not include zone.js itself or long-stack-trace-zone.js` here as
// they are included already in angular2-polyfills
'
node_modules/zone.js/dist/jasmine-patch.js
'
,
'
node_modules/zone.js/dist/async-test.js
'
,
'
node_modules/zone.js/dist/fake-async-test.js
'
,
// RxJs
'
node_modules/rxjs/bundles/Rx.js
'
,
// Angular 2 itself and the testing library
'
node_modules/angular2/bundles/angular2.js
'
,
'
node_modules/angular2/bundles/router.dev.js
'
,
'
node_modules/angular2/bundles/http.dev.js
'
,
'
node_modules/angular2/bundles/testing.dev.js
'
,
'
karma-test-shim.js
'
,
// transpiled application & spec code paths loaded via module imports
{
pattern
:
appBase
+
'
**/*.js
'
,
included
:
false
,
watched
:
true
},
...
...
@@ -47,7 +56,7 @@ module.exports = function(config) {
{
pattern
:
appBase
+
'
**/*.css
'
,
included
:
false
,
watched
:
true
},
// paths for debugging with source maps in dev tools
{
pattern
:
appBase
+
'
**/*.ts
'
,
included
:
false
,
watched
:
tru
e
},
{
pattern
:
appBase
+
'
**/*.ts
'
,
included
:
false
,
watched
:
fals
e
},
{
pattern
:
appBase
+
'
**/*.js.map
'
,
included
:
false
,
watched
:
false
}
],
...
...
wallaby.js
View file @
7a268b5a
...
...
@@ -5,12 +5,22 @@ module.exports = function () {
return
{
files
:
[
{
pattern
:
'
node_modules/es6-shim/es6-shim.js
'
,
instrument
:
false
},
// System.js for module loading
{
pattern
:
'
node_modules/systemjs/dist/system-polyfills.js
'
,
instrument
:
false
},
{
pattern
:
'
node_modules/systemjs/dist/system.js
'
,
instrument
:
false
},
{
pattern
:
'
node_modules/reflect-metadata/Reflect.js
'
,
instrument
:
false
},
{
pattern
:
'
node_modules/zone.js/dist/zone.js
'
,
instrument
:
false
},
{
pattern
:
'
node_modules/zone.js/dist/long-stack-trace-zone.js
'
,
instrument
:
false
},
// Polyfills
{
pattern
:
'
node_modules/es6-shim/es6-shim.js
'
,
instrument
:
false
},
{
pattern
:
'
node_modules/angular2/bundles/angular2-polyfills.js
'
,
instrument
:
false
},
// Zone.js dependencies
// Note - do not include zone.js itself or long-stack-trace-zone.js` here as
// they are included already in angular2-polyfills
{
pattern
:
'
node_modules/zone.js/dist/jasmine-patch.js
'
,
instrument
:
false
},
{
pattern
:
'
node_modules/zone.js/dist/async-test.js
'
,
instrument
:
false
},
{
pattern
:
'
node_modules/zone.js/dist/fake-async-test.js
'
,
instrument
:
false
},
// Rx.js, Angular 2 itself, and the testing library not here because loaded by systemjs
{
pattern
:
'
app/**/*+(ts|html|css)
'
,
load
:
false
},
{
pattern
:
'
app/**/*.spec.ts
'
,
ignore
:
true
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment