forked from emberjs/ember.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update ember-testing tests to new syntax
Part of emberjs#15988
- Loading branch information
Showing
8 changed files
with
297 additions
and
286 deletions.
There are no files selected for viewing
This file contains 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,25 +1,30 @@ | ||
import { run } from 'ember-metal'; | ||
import Adapter from '../../adapters/adapter'; | ||
import { moduleFor, AbstractTestCase } from 'internal-test-helpers'; | ||
|
||
var adapter; | ||
|
||
QUnit.module('ember-testing Adapter', { | ||
setup() { | ||
moduleFor('ember-testing Adapter', class extends AbstractTestCase { | ||
constructor() { | ||
super(); | ||
adapter = new Adapter(); | ||
}, | ||
} | ||
|
||
teardown() { | ||
run(adapter, adapter.destroy); | ||
} | ||
}); | ||
|
||
QUnit.test('exception throws', function() { | ||
var error = 'Hai'; | ||
var thrown; | ||
['@test exception throws'](assert) { | ||
var error = 'Hai'; | ||
var thrown; | ||
|
||
try { | ||
adapter.exception(error); | ||
} catch (e) { | ||
thrown = e; | ||
try { | ||
adapter.exception(error); | ||
} catch (e) { | ||
thrown = e; | ||
} | ||
assert.equal(thrown, error); | ||
} | ||
equal(thrown, error); | ||
|
||
}); | ||
|
This file contains 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,51 +1,55 @@ | ||
import { run } from 'ember-metal'; | ||
import QUnitAdapter from '../../adapters/qunit'; | ||
import { moduleFor, AbstractTestCase } from 'internal-test-helpers'; | ||
|
||
var adapter; | ||
|
||
QUnit.module('ember-testing QUnitAdapter', { | ||
setup() { | ||
moduleFor('ember-testing QUnitAdapter', class extends AbstractTestCase { | ||
constructor() { | ||
super(); | ||
adapter = new QUnitAdapter(); | ||
}, | ||
} | ||
|
||
teardown() { | ||
run(adapter, adapter.destroy); | ||
} | ||
}); | ||
|
||
QUnit.test('asyncStart calls stop', function() { | ||
var originalStop = QUnit.stop; | ||
try { | ||
QUnit.stop = function() { | ||
ok(true, 'stop called'); | ||
}; | ||
adapter.asyncStart(); | ||
} finally { | ||
QUnit.stop = originalStop; | ||
['@test asyncStart calls stop'](assert) { | ||
var originalStop = QUnit.stop; | ||
try { | ||
QUnit.stop = function() { | ||
assert.ok(true, 'stop called'); | ||
}; | ||
adapter.asyncStart(); | ||
} finally { | ||
QUnit.stop = originalStop; | ||
} | ||
} | ||
}); | ||
|
||
QUnit.test('asyncEnd calls start', function() { | ||
var originalStart = QUnit.start; | ||
try { | ||
QUnit.start = function() { | ||
ok(true, 'start called'); | ||
}; | ||
adapter.asyncEnd(); | ||
} finally { | ||
QUnit.start = originalStart; | ||
['@test asyncEnd calls start'](assert) { | ||
var originalStart = QUnit.start; | ||
try { | ||
QUnit.start = function() { | ||
assert.ok(true, 'start called'); | ||
}; | ||
adapter.asyncEnd(); | ||
} finally { | ||
QUnit.start = originalStart; | ||
} | ||
} | ||
}); | ||
|
||
QUnit.test('exception causes a failing assertion', function() { | ||
var error = { err: 'hai' }; | ||
var originalOk = window.ok; | ||
try { | ||
window.ok = function(val, msg) { | ||
originalOk(!val, 'ok is called with false'); | ||
originalOk(msg, '{err: "hai"}'); | ||
}; | ||
adapter.exception(error); | ||
} finally { | ||
window.ok = originalOk; | ||
['@test exception causes a failing assertion']() { | ||
var error = { err: 'hai' }; | ||
var originalOk = window.ok; | ||
try { | ||
window.ok = function(val, msg) { | ||
originalOk(!val, 'ok is called with false'); | ||
originalOk(msg, '{err: "hai"}'); | ||
}; | ||
adapter.exception(error); | ||
} finally { | ||
window.ok = originalOk; | ||
} | ||
} | ||
}); | ||
|
This file contains 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
Oops, something went wrong.