-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16029 from thoov/ember-routing-test-conversion
[CLEANUP] Convert ember-routing tests to new style (Part 2)
- Loading branch information
Showing
4 changed files
with
784 additions
and
784 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,48 +1,52 @@ | ||
import BucketCache from '../../system/cache'; | ||
import { moduleFor, AbstractTestCase } from 'internal-test-helpers'; | ||
|
||
moduleFor('BucketCache', class extends AbstractTestCase { | ||
constructor() { | ||
super(); | ||
|
||
QUnit.module('BucketCache', { | ||
setup() { | ||
this.cache = BucketCache.create(); | ||
} | ||
}); | ||
|
||
QUnit.test('has - returns false when bucket is not in cache', function(assert) { | ||
assert.strictEqual(this.cache.has('foo'), false); | ||
assert.strictEqual(this.cache.has('constructor'), false); | ||
}); | ||
['@test has - returns false when bucket is not in cache'](assert) { | ||
assert.strictEqual(this.cache.has('foo'), false); | ||
assert.strictEqual(this.cache.has('constructor'), false); | ||
} | ||
|
||
QUnit.test('has - returns true when bucket is in cache', function(assert) { | ||
let token = {}; | ||
['@test has - returns true when bucket is in cache'](assert) { | ||
let token = {}; | ||
|
||
this.cache.stash('foo', 'bar', token); | ||
this.cache.stash('constructor', 'bar', token); | ||
this.cache.stash('foo', 'bar', token); | ||
this.cache.stash('constructor', 'bar', token); | ||
|
||
assert.strictEqual(this.cache.has('foo'), true); | ||
assert.strictEqual(this.cache.has('constructor'), true); | ||
}); | ||
assert.strictEqual(this.cache.has('foo'), true); | ||
assert.strictEqual(this.cache.has('constructor'), true); | ||
} | ||
|
||
QUnit.test('lookup - returns stashed value if key does exist in bucket', function(assert) { | ||
let token = {}; | ||
let defaultValue = {}; | ||
['@test lookup - returns stashed value if key does exist in bucket'](assert) { | ||
let token = {}; | ||
let defaultValue = {}; | ||
|
||
this.cache.stash('foo', 'bar', token); | ||
this.cache.stash('foo', 'bar', token); | ||
|
||
assert.strictEqual(this.cache.lookup('foo', 'bar', defaultValue), token); | ||
}); | ||
assert.strictEqual(this.cache.lookup('foo', 'bar', defaultValue), token); | ||
} | ||
|
||
QUnit.test('lookup - returns default value if key does not exist in bucket', function(assert) { | ||
let token = {}; | ||
let defaultValue = {}; | ||
['@test lookup - returns default value if key does not exist in bucket'](assert) { | ||
let token = {}; | ||
let defaultValue = {}; | ||
|
||
this.cache.stash('foo', 'bar', token); | ||
this.cache.stash('foo', 'bar', token); | ||
|
||
assert.strictEqual(this.cache.lookup('foo', 'boo', defaultValue), defaultValue); | ||
assert.strictEqual(this.cache.lookup('foo', 'constructor', defaultValue), defaultValue); | ||
}); | ||
assert.strictEqual(this.cache.lookup('foo', 'boo', defaultValue), defaultValue); | ||
assert.strictEqual(this.cache.lookup('foo', 'constructor', defaultValue), defaultValue); | ||
} | ||
|
||
QUnit.test('lookup - returns default value if bucket does not exist', function(assert) { | ||
let defaultValue = {}; | ||
['@test lookup - returns default value if bucket does not exist'](assert) { | ||
let defaultValue = {}; | ||
|
||
assert.strictEqual(this.cache.lookup('boo', 'bar', defaultValue), defaultValue); | ||
assert.strictEqual(this.cache.lookup('constructor', 'bar', defaultValue), defaultValue); | ||
assert.strictEqual(this.cache.lookup('boo', 'bar', defaultValue), defaultValue); | ||
assert.strictEqual(this.cache.lookup('constructor', 'bar', defaultValue), defaultValue); | ||
} | ||
}); | ||
|
Oops, something went wrong.