test: reactivate some of the disabled tests in Edge (#10450)

This commit is contained in:
Marc Laval 2016-08-02 19:58:03 +02:00 committed by Victor Berchet
parent d6d4568830
commit 7db75fa361
3 changed files with 83 additions and 95 deletions

View File

@ -110,39 +110,35 @@ export function main() {
expect(obj.b).toEqual(2); expect(obj.b).toEqual(2);
}); });
// Makes Edge to disconnect when running the full unit test campaign it('should check args from no to max', () => {
// TODO: remove when issue is solved: https://github.com/angular/angular/issues/4756 var f = (t: any /** TODO #9100 */) => reflector.factory(t);
if (!browserDetection.isEdge) { var checkArgs = (obj: any /** TODO #9100 */, args: any /** TODO #9100 */) =>
it('should check args from no to max', () => { expect(obj.args).toEqual(args);
var f = (t: any /** TODO #9100 */) => reflector.factory(t);
var checkArgs = (obj: any /** TODO #9100 */, args: any /** TODO #9100 */) =>
expect(obj.args).toEqual(args);
// clang-format off // clang-format off
checkArgs(f(TestObjWith00Args)(), []); checkArgs(f(TestObjWith00Args)(), []);
checkArgs(f(TestObjWith01Args)(1), [1]); checkArgs(f(TestObjWith01Args)(1), [1]);
checkArgs(f(TestObjWith02Args)(1, 2), [1, 2]); checkArgs(f(TestObjWith02Args)(1, 2), [1, 2]);
checkArgs(f(TestObjWith03Args)(1, 2, 3), [1, 2, 3]); checkArgs(f(TestObjWith03Args)(1, 2, 3), [1, 2, 3]);
checkArgs(f(TestObjWith04Args)(1, 2, 3, 4), [1, 2, 3, 4]); checkArgs(f(TestObjWith04Args)(1, 2, 3, 4), [1, 2, 3, 4]);
checkArgs(f(TestObjWith05Args)(1, 2, 3, 4, 5), [1, 2, 3, 4, 5]); checkArgs(f(TestObjWith05Args)(1, 2, 3, 4, 5), [1, 2, 3, 4, 5]);
checkArgs(f(TestObjWith06Args)(1, 2, 3, 4, 5, 6), [1, 2, 3, 4, 5, 6]); checkArgs(f(TestObjWith06Args)(1, 2, 3, 4, 5, 6), [1, 2, 3, 4, 5, 6]);
checkArgs(f(TestObjWith07Args)(1, 2, 3, 4, 5, 6, 7), [1, 2, 3, 4, 5, 6, 7]); checkArgs(f(TestObjWith07Args)(1, 2, 3, 4, 5, 6, 7), [1, 2, 3, 4, 5, 6, 7]);
checkArgs(f(TestObjWith08Args)(1, 2, 3, 4, 5, 6, 7, 8), [1, 2, 3, 4, 5, 6, 7, 8]); checkArgs(f(TestObjWith08Args)(1, 2, 3, 4, 5, 6, 7, 8), [1, 2, 3, 4, 5, 6, 7, 8]);
checkArgs(f(TestObjWith09Args)(1, 2, 3, 4, 5, 6, 7, 8, 9), [1, 2, 3, 4, 5, 6, 7, 8, 9]); checkArgs(f(TestObjWith09Args)(1, 2, 3, 4, 5, 6, 7, 8, 9), [1, 2, 3, 4, 5, 6, 7, 8, 9]);
checkArgs(f(TestObjWith10Args)(1, 2, 3, 4, 5, 6, 7, 8, 9, 10), [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]); checkArgs(f(TestObjWith10Args)(1, 2, 3, 4, 5, 6, 7, 8, 9, 10), [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);
checkArgs(f(TestObjWith11Args)(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11), [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]); checkArgs(f(TestObjWith11Args)(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11), [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]);
checkArgs(f(TestObjWith12Args)(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12), [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]); checkArgs(f(TestObjWith12Args)(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12), [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]);
checkArgs(f(TestObjWith13Args)(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13), [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]); checkArgs(f(TestObjWith13Args)(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13), [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]);
checkArgs(f(TestObjWith14Args)(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14), [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]); checkArgs(f(TestObjWith14Args)(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14), [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]);
checkArgs(f(TestObjWith15Args)(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15), [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]); checkArgs(f(TestObjWith15Args)(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15), [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]);
checkArgs(f(TestObjWith16Args)(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16), [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]); checkArgs(f(TestObjWith16Args)(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16), [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]);
checkArgs(f(TestObjWith17Args)(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17), [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17]); checkArgs(f(TestObjWith17Args)(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17), [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17]);
checkArgs(f(TestObjWith18Args)(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18), [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18]); checkArgs(f(TestObjWith18Args)(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18), [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18]);
checkArgs(f(TestObjWith19Args)(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19), [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]); checkArgs(f(TestObjWith19Args)(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19), [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]);
checkArgs(f(TestObjWith20Args)(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20), [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]); checkArgs(f(TestObjWith20Args)(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20), [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]);
// clang-format on // clang-format on
}); });
}
it('should throw when more than 20 arguments', it('should throw when more than 20 arguments',
() => { expect(() => reflector.factory(TestObjWith21Args)).toThrowError(); }); () => { expect(() => reflector.factory(TestObjWith21Args)).toThrowError(); });

View File

@ -56,51 +56,47 @@ export function main() {
expect(called).toBe(true); expect(called).toBe(true);
}); });
// Makes Edge to disconnect when running the full unit test campaign it('delivers next and error events synchronously',
// TODO: remove when issue is solved: https://github.com/angular/angular/issues/4756 inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
if (!browserDetection.isEdge) { let log: any[] /** TODO #9100 */ = [];
it('delivers next and error events synchronously', ObservableWrapper.subscribe(
inject([AsyncTestCompleter], (async: AsyncTestCompleter) => { emitter,
let log: any[] /** TODO #9100 */ = []; (x) => {
ObservableWrapper.subscribe( log.push(x);
emitter, expect(log).toEqual([1, 2]);
(x) => { },
log.push(x); (err) => {
expect(log).toEqual([1, 2]); log.push(err);
}, expect(log).toEqual([1, 2, 3, 4]);
(err) => { async.done();
log.push(err); });
expect(log).toEqual([1, 2, 3, 4]); log.push(1);
async.done(); ObservableWrapper.callEmit(emitter, 2);
}); log.push(3);
log.push(1); ObservableWrapper.callError(emitter, 4);
ObservableWrapper.callEmit(emitter, 2); log.push(5);
log.push(3); }));
ObservableWrapper.callError(emitter, 4);
log.push(5);
}));
it('delivers next and complete events synchronously', () => { it('delivers next and complete events synchronously', () => {
let log: any[] /** TODO #9100 */ = []; let log: any[] /** TODO #9100 */ = [];
ObservableWrapper.subscribe( ObservableWrapper.subscribe(
emitter, emitter,
(x) => { (x) => {
log.push(x); log.push(x);
expect(log).toEqual([1, 2]); expect(log).toEqual([1, 2]);
}, },
null, null,
() => { () => {
log.push(4); log.push(4);
expect(log).toEqual([1, 2, 3, 4]); expect(log).toEqual([1, 2, 3, 4]);
}); });
log.push(1); log.push(1);
ObservableWrapper.callEmit(emitter, 2); ObservableWrapper.callEmit(emitter, 2);
log.push(3); log.push(3);
ObservableWrapper.callComplete(emitter); ObservableWrapper.callComplete(emitter);
log.push(5); log.push(5);
expect(log).toEqual([1, 2, 3, 4, 5]); expect(log).toEqual([1, 2, 3, 4, 5]);
}); });
}
it('delivers events asynchronously when forced to async mode', it('delivers events asynchronously when forced to async mode',
inject([AsyncTestCompleter], (async: AsyncTestCompleter) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {

View File

@ -46,24 +46,20 @@ export function main() {
{'method': TEST_METHOD, 'args': [PASSED_ARG_1, PASSED_ARG_2]}); {'method': TEST_METHOD, 'args': [PASSED_ARG_1, PASSED_ARG_2]});
})); }));
// TODO(pkozlowski): this fails only in Edge with it('should return promises to the worker', inject([Serializer], (serializer: Serializer) => {
// "No provider for RenderStore! (Serializer -> RenderStore)" var broker = new ServiceMessageBroker_(messageBuses.ui, serializer, CHANNEL);
if (!browserDetection.isEdge) { broker.registerMethod(TEST_METHOD, [PRIMITIVE], (arg1) => {
it('should return promises to the worker', inject([Serializer], (serializer: Serializer) => { expect(arg1).toEqual(PASSED_ARG_1);
var broker = new ServiceMessageBroker_(messageBuses.ui, serializer, CHANNEL); return PromiseWrapper.wrap(() => { return RESULT; });
broker.registerMethod(TEST_METHOD, [PRIMITIVE], (arg1) => { });
expect(arg1).toEqual(PASSED_ARG_1); ObservableWrapper.callEmit(
return PromiseWrapper.wrap(() => { return RESULT; }); messageBuses.worker.to(CHANNEL),
}); {'method': TEST_METHOD, 'id': ID, 'args': [PASSED_ARG_1]});
ObservableWrapper.callEmit( ObservableWrapper.subscribe(messageBuses.worker.from(CHANNEL), (data: any) => {
messageBuses.worker.to(CHANNEL), expect(data.type).toEqual('result');
{'method': TEST_METHOD, 'id': ID, 'args': [PASSED_ARG_1]}); expect(data.id).toEqual(ID);
ObservableWrapper.subscribe(messageBuses.worker.from(CHANNEL), (data: any) => { expect(data.value).toEqual(RESULT);
expect(data.type).toEqual('result'); });
expect(data.id).toEqual(ID); }));
expect(data.value).toEqual(RESULT);
});
}));
}
}); });
} }