Fix #4886 and add test. (#4954)

master
Adrian Leonhard 2018-08-08 17:24:25 +02:00 committed by Suchipi
parent 1391891ef6
commit c83d5b15e7
3 changed files with 127 additions and 1 deletions

View File

@ -5814,7 +5814,9 @@ function isAngularTestWrapper(node) {
(node.type === "CallExpression" ||
node.type === "OptionalCallExpression") &&
node.callee.type === "Identifier" &&
(node.callee.name === "async" || node.callee.name === "inject")
(node.callee.name === "async" ||
node.callee.name === "inject" ||
node.callee.name === "fakeAsync")
);
}

View File

@ -102,6 +102,108 @@ function x() {
`;
exports[`angular_fakeAsync.js - flow-verify 1`] = `
beforeEach(fakeAsync(() => {
// code
}));
afterAll(fakeAsync(() => {
console.log('Hello');
}));
it('should create the app', fakeAsync(() => {
//code
}));
it("does something really long and complicated so I have to write a very long name for the test", fakeAsync(() => {
// code
}));
/*
* isTestCall(parent) should only be called when parent exists
* and parent.type is CallExpression. This test makes sure that
* no errors are thrown when calling isTestCall(parent)
*/
function x() { fakeAsync(() => {}) }
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
beforeEach(fakeAsync(() => {
// code
}));
afterAll(fakeAsync(() => {
console.log("Hello");
}));
it("should create the app", fakeAsync(() => {
//code
}));
it("does something really long and complicated so I have to write a very long name for the test", fakeAsync(() => {
// code
}));
/*
* isTestCall(parent) should only be called when parent exists
* and parent.type is CallExpression. This test makes sure that
* no errors are thrown when calling isTestCall(parent)
*/
function x() {
fakeAsync(() => {});
}
`;
exports[`angular_fakeAsync.js - flow-verify 2`] = `
beforeEach(fakeAsync(() => {
// code
}));
afterAll(fakeAsync(() => {
console.log('Hello');
}));
it('should create the app', fakeAsync(() => {
//code
}));
it("does something really long and complicated so I have to write a very long name for the test", fakeAsync(() => {
// code
}));
/*
* isTestCall(parent) should only be called when parent exists
* and parent.type is CallExpression. This test makes sure that
* no errors are thrown when calling isTestCall(parent)
*/
function x() { fakeAsync(() => {}) }
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
beforeEach(fakeAsync(() => {
// code
}));
afterAll(fakeAsync(() => {
console.log("Hello");
}));
it("should create the app", fakeAsync(() => {
//code
}));
it("does something really long and complicated so I have to write a very long name for the test", fakeAsync(() => {
// code
}));
/*
* isTestCall(parent) should only be called when parent exists
* and parent.type is CallExpression. This test makes sure that
* no errors are thrown when calling isTestCall(parent)
*/
function x() {
fakeAsync(() => {});
}
`;
exports[`angularjs_inject.js - flow-verify 1`] = `
beforeEach(inject(($fooService, $barService) => {
// code

View File

@ -0,0 +1,22 @@
beforeEach(fakeAsync(() => {
// code
}));
afterAll(fakeAsync(() => {
console.log('Hello');
}));
it('should create the app', fakeAsync(() => {
//code
}));
it("does something really long and complicated so I have to write a very long name for the test", fakeAsync(() => {
// code
}));
/*
* isTestCall(parent) should only be called when parent exists
* and parent.type is CallExpression. This test makes sure that
* no errors are thrown when calling isTestCall(parent)
*/
function x() { fakeAsync(() => {}) }