angular-cn/modules/angular2/test/di/key_spec.js

25 lines
722 B
JavaScript
Raw Normal View History

import {describe, iit, it, expect, beforeEach} from 'angular2/test_lib';
import {Key, KeyRegistry} from 'angular2/di';
2014-10-07 10:34:07 -04:00
export function main() {
describe("key", function () {
var registry;
2014-10-20 15:17:06 -04:00
beforeEach(function () {
registry = new KeyRegistry();
2014-10-20 15:17:06 -04:00
});
it('should be equal to another key if type is the same', function () {
expect(registry.get('car')).toBe(registry.get('car'));
});
it('should not be equal to another key if types are different', function () {
expect(registry.get('car')).not.toBe(registry.get('porsche'));
});
2014-10-10 16:31:27 -04:00
it('should return the passed in key', function () {
expect(registry.get(registry.get('car'))).toBe(registry.get('car'));
2014-10-10 16:31:27 -04:00
});
2014-10-20 15:17:06 -04:00
});
}