-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Transform tests to 'setup-test' syntax (#90)
Transform tests to 'setup-test' syntax
- Loading branch information
Showing
13 changed files
with
511 additions
and
497 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 |
---|---|---|
|
@@ -3,4 +3,4 @@ | |
|
||
module.exports = function(/* environment, appConfig */) { | ||
return { }; | ||
}; | ||
} |
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
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
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
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
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,8 +1,7 @@ | ||
import resolver from './helpers/resolver'; | ||
import { | ||
setResolver | ||
} from 'ember-qunit'; | ||
import { start } from 'ember-cli-qunit'; | ||
import Application from '../app'; | ||
import config from '../config/environment'; | ||
import { setApplication } from '@ember/test-helpers'; | ||
import { start } from 'ember-qunit'; | ||
|
||
setResolver(resolver); | ||
setApplication(Application.create(config.APP)); | ||
start(); |
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
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,32 +1,36 @@ | ||
import AssetLoadError from 'ember-asset-loader/errors/asset-load'; | ||
import { module, test } from 'qunit'; | ||
|
||
module('Unit | Error | asset-load', { | ||
asset: { | ||
type: 'js', | ||
uri: 'some-js-file.js' | ||
}, | ||
loader: { | ||
loadAsset(asset) { | ||
return `Loaded ${asset.type} asset with uri "${asset.uri}".`; | ||
} | ||
}, | ||
originalError: new Error('some error') | ||
}); | ||
module('Unit | Error | asset-load', function(hooks) { | ||
hooks.beforeEach(function() { | ||
this.asset = { | ||
type: 'js', | ||
uri: 'some-js-file.js' | ||
}; | ||
|
||
test('constructor() - accepts an asset and the original error', function(assert) { | ||
const error = new AssetLoadError(this.loader, this.asset, this.originalError); | ||
assert.ok(error instanceof Error, 'AssetLoadError inherits Error'); | ||
assert.ok(error.stack, 'stack is preserved'); | ||
assert.strictEqual(error.asset, this.asset, 'asset is set'); | ||
}); | ||
this.loader = { | ||
loadAsset(asset) { | ||
return `Loaded ${asset.type} asset with uri "${asset.uri}".`; | ||
} | ||
}; | ||
|
||
test('toString() - has correct name and message', function(assert) { | ||
const error = new AssetLoadError(this.loader, this.asset, this.originalError); | ||
assert.equal(error.toString(), 'AssetLoadError: The js asset with uri "some-js-file.js" failed to load with the error: Error: some error.'); | ||
}); | ||
this.originalError = new Error('some error'); | ||
}); | ||
|
||
test('constructor() - accepts an asset and the original error', function(assert) { | ||
const error = new AssetLoadError(this.loader, this.asset, this.originalError); | ||
assert.ok(error instanceof Error, 'AssetLoadError inherits Error'); | ||
assert.ok(error.stack, 'stack is preserved'); | ||
assert.strictEqual(error.asset, this.asset, 'asset is set'); | ||
}); | ||
|
||
test('toString() - has correct name and message', function(assert) { | ||
const error = new AssetLoadError(this.loader, this.asset, this.originalError); | ||
assert.equal(error.toString(), 'AssetLoadError: The js asset with uri "some-js-file.js" failed to load with the error: Error: some error.'); | ||
}); | ||
|
||
test('retryLoad() - calls loadAsset on the loader', function(assert) { | ||
const error = new AssetLoadError(this.loader, this.asset, this.originalError); | ||
assert.equal(error.retryLoad(), 'Loaded js asset with uri "some-js-file.js".'); | ||
test('retryLoad() - calls loadAsset on the loader', function(assert) { | ||
const error = new AssetLoadError(this.loader, this.asset, this.originalError); | ||
assert.equal(error.retryLoad(), 'Loaded js asset with uri "some-js-file.js".'); | ||
}); | ||
}); |
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,32 +1,36 @@ | ||
import BundleLoadError from 'ember-asset-loader/errors/bundle-load'; | ||
import { module, test } from 'qunit'; | ||
|
||
module('Unit | Error | bundle-load', { | ||
bundleName: 'herp-de-derp', | ||
errors: [ | ||
new Error('derp error') | ||
], | ||
loader: { | ||
loadBundle(bundleName) { | ||
return `Loaded the bundle "${bundleName}".`; | ||
} | ||
} | ||
}); | ||
module('Unit | Error | bundle-load', function(hooks) { | ||
hooks.beforeEach(function() { | ||
this.bundleName = 'herp-de-derp'; | ||
|
||
test('constructor() - accepts a bundleName and errors array', function(assert) { | ||
const error = new BundleLoadError(this.loader, this.bundleName, this.errors); | ||
assert.ok(error instanceof Error, 'BundleLoadError inherits Error'); | ||
assert.ok(error.stack, 'stack is preserved'); | ||
assert.equal(error.bundleName, this.bundleName, 'bundleName is set'); | ||
assert.strictEqual(error.errors, this.errors, 'errors is set'); | ||
}); | ||
this.errors = [ | ||
new Error('derp error') | ||
]; | ||
|
||
test('toString() - has correct name and message', function(assert) { | ||
const error = new BundleLoadError(this.loader, this.bundleName, this.errors); | ||
assert.equal(error.toString(), 'BundleLoadError: The bundle "herp-de-derp" failed to load.'); | ||
}); | ||
this.loader = { | ||
loadBundle(bundleName) { | ||
return `Loaded the bundle "${bundleName}".`; | ||
} | ||
}; | ||
}); | ||
|
||
test('constructor() - accepts a bundleName and errors array', function(assert) { | ||
const error = new BundleLoadError(this.loader, this.bundleName, this.errors); | ||
assert.ok(error instanceof Error, 'BundleLoadError inherits Error'); | ||
assert.ok(error.stack, 'stack is preserved'); | ||
assert.equal(error.bundleName, this.bundleName, 'bundleName is set'); | ||
assert.strictEqual(error.errors, this.errors, 'errors is set'); | ||
}); | ||
|
||
test('toString() - has correct name and message', function(assert) { | ||
const error = new BundleLoadError(this.loader, this.bundleName, this.errors); | ||
assert.equal(error.toString(), 'BundleLoadError: The bundle "herp-de-derp" failed to load.'); | ||
}); | ||
|
||
test('retryLoad() - calls loadBundle on the loader', function(assert) { | ||
const error = new BundleLoadError(this.loader, this.bundleName, this.errors); | ||
assert.equal(error.retryLoad(), 'Loaded the bundle "herp-de-derp".'); | ||
test('retryLoad() - calls loadBundle on the loader', function(assert) { | ||
const error = new BundleLoadError(this.loader, this.bundleName, this.errors); | ||
assert.equal(error.retryLoad(), 'Loaded the bundle "herp-de-derp".'); | ||
}); | ||
}); |
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,25 @@ | ||
import LoadError from 'ember-asset-loader/errors/load'; | ||
import { module, test } from 'qunit'; | ||
|
||
module('Unit | Error | load'); | ||
module('Unit | Error | load', function() { | ||
test('constructor() - accepts a message and a loader', function(assert) { | ||
const message = 'herp-de-derp'; | ||
const loader = {}; | ||
const error = new LoadError(message, loader); | ||
|
||
test('constructor() - accepts a message and a loader', function(assert) { | ||
const message = 'herp-de-derp'; | ||
const loader = {}; | ||
const error = new LoadError(message, loader); | ||
assert.ok(error instanceof Error, 'LoadError inherits Error'); | ||
assert.ok(error.stack, 'stack is preserved'); | ||
assert.equal(error.message, message, 'message is set'); | ||
assert.strictEqual(error.loader, loader, 'loader is set'); | ||
}); | ||
|
||
assert.ok(error instanceof Error, 'LoadError inherits Error'); | ||
assert.ok(error.stack, 'stack is preserved'); | ||
assert.equal(error.message, message, 'message is set'); | ||
assert.strictEqual(error.loader, loader, 'loader is set'); | ||
}); | ||
|
||
test('toString() - has correct name and message', function(assert) { | ||
const error = new LoadError('herp-de-derp'); | ||
assert.equal(error.toString(), 'LoadError: herp-de-derp'); | ||
}); | ||
test('toString() - has correct name and message', function(assert) { | ||
const error = new LoadError('herp-de-derp'); | ||
assert.equal(error.toString(), 'LoadError: herp-de-derp'); | ||
}); | ||
|
||
test('retryLoad() - throws an error', function(assert) { | ||
const error = new LoadError(); | ||
assert.throws(() => error.retryLoad(), /You must define a behavior for 'retryLoad' in a subclass./); | ||
test('retryLoad() - throws an error', function(assert) { | ||
const error = new LoadError(); | ||
assert.throws(() => error.retryLoad(), /You must define a behavior for 'retryLoad' in a subclass./); | ||
}); | ||
}); |
Oops, something went wrong.