提交 f090e9ef 编写于 作者: D du-zhihai

适配修改

Signed-off-by: Ndu-zhihai <duzhihai@huawei.com>
Change-Id: Ie75ca0b6c887d738ad9605792c30efb49df2acb4
上级 37597b1f
...@@ -38,20 +38,34 @@ describe('continuationManagerTest', function() { ...@@ -38,20 +38,34 @@ describe('continuationManagerTest', function() {
beforeEach(async function (done) { beforeEach(async function (done) {
console.info('beforeEach'); console.info('beforeEach');
await continuationManager.register(function (err, data) { try {
await continuationManager.registerContinuation().then((data) => {
token = data; token = data;
console.info('beforeEach register success'); console.info('beforeEach registerContinuation success');
done(); done();
})
.catch((e) => {
console.info("beforeEach promise error: " + e);
}); });
} catch (e) {
console.info("beforeEach try error: " + e);
}
console.info('beforeEach end'); console.info('beforeEach end');
}) })
afterEach(async function (done) { afterEach(async function (done) {
console.info('afterEach'); console.info('afterEach');
await continuationManager.unregister(token, function (err, data) { try {
console.info('afterEach unregister success'); await continuationManager.unregisterContinuation(token).then((data) => {
console.info('afterEach unregisterContinuation success');
done(); done();
})
.catch((e) => {
console.info("afterEach promise error: " + e);
}); });
} catch (e) {
console.info("afterEach try error: " + e);
}
console.info('afterEach end'); console.info('afterEach end');
}) })
...@@ -65,7 +79,6 @@ describe('continuationManagerTest', function() { ...@@ -65,7 +79,6 @@ describe('continuationManagerTest', function() {
console.info("testRegister001Begin "); console.info("testRegister001Begin ");
continuationManager.register(function (err, data) { continuationManager.register(function (err, data) {
expect(err.code == 0).assertTrue(); expect(err.code == 0).assertTrue();
expect(data - token == 1).assertTrue();
done(); done();
}); });
} catch (e) { } catch (e) {
...@@ -146,7 +159,6 @@ describe('continuationManagerTest', function() { ...@@ -146,7 +159,6 @@ describe('continuationManagerTest', function() {
}; };
continuationManager.register(continuationExtraParams, function(err, data) { continuationManager.register(continuationExtraParams, function(err, data) {
expect(err.code == 0).assertTrue(); expect(err.code == 0).assertTrue();
expect(data - token == 1).assertTrue();
done(); done();
}); });
} catch (e) { } catch (e) {
...@@ -174,7 +186,6 @@ describe('continuationManagerTest', function() { ...@@ -174,7 +186,6 @@ describe('continuationManagerTest', function() {
}; };
continuationManager.register(continuationExtraParams, function(err, data) { continuationManager.register(continuationExtraParams, function(err, data) {
expect(err.code == 0).assertTrue(); expect(err.code == 0).assertTrue();
expect(data - token == 1).assertTrue();
done(); done();
}); });
} catch (e) { } catch (e) {
...@@ -200,7 +211,7 @@ describe('continuationManagerTest', function() { ...@@ -200,7 +211,7 @@ describe('continuationManagerTest', function() {
authInfo: {"name": "authInfo","length": 8} authInfo: {"name": "authInfo","length": 8}
}; };
continuationManager.register(continuationExtraParams).then((data) => { continuationManager.register(continuationExtraParams).then((data) => {
expect(data - token == 1).assertTrue(); expect(data != -1).assertTrue();
}).catch((err) => { }).catch((err) => {
expect(err.code == 29360210).assertTrue(); expect(err.code == 29360210).assertTrue();
}); });
...@@ -227,7 +238,7 @@ describe('continuationManagerTest', function() { ...@@ -227,7 +238,7 @@ describe('continuationManagerTest', function() {
authInfo: {"name": "authInfo","length": 8} authInfo: {"name": "authInfo","length": 8}
}; };
continuationManager.register(continuationExtraParams).then((data) => { continuationManager.register(continuationExtraParams).then((data) => {
expect(data - token == 1).assertTrue(); expect(data != -1).assertTrue();
}).catch((err) => { }).catch((err) => {
expect(err.code == 29360210).assertTrue(); expect(err.code == 29360210).assertTrue();
}); });
...@@ -254,7 +265,7 @@ describe('continuationManagerTest', function() { ...@@ -254,7 +265,7 @@ describe('continuationManagerTest', function() {
authInfo: {} authInfo: {}
}; };
continuationManager.register(continuationExtraParams).then((data) => { continuationManager.register(continuationExtraParams).then((data) => {
expect(data - token != 1).assertTrue(); expect(data != -1).assertTrue();
}).catch((err) => { }).catch((err) => {
expect(err.code == 29360210).assertTrue(); expect(err.code == 29360210).assertTrue();
}); });
...@@ -281,7 +292,7 @@ describe('continuationManagerTest', function() { ...@@ -281,7 +292,7 @@ describe('continuationManagerTest', function() {
authInfo: {"name": "authInfo","length": 8} authInfo: {"name": "authInfo","length": 8}
}; };
continuationManager.register(continuationExtraParams).then((data) => { continuationManager.register(continuationExtraParams).then((data) => {
expect(data - token != 1).assertTrue(); expect(data != -1).assertTrue();
}).catch((err) => { }).catch((err) => {
expect(err.code == 29360210).assertTrue(); expect(err.code == 29360210).assertTrue();
}); });
...@@ -302,7 +313,7 @@ describe('continuationManagerTest', function() { ...@@ -302,7 +313,7 @@ describe('continuationManagerTest', function() {
it('testRegister010', 0, async function(done) { it('testRegister010', 0, async function(done) {
try { try {
continuationManager.register().then((data) => { continuationManager.register().then((data) => {
expect(data - token == 1).assertTrue(); expect(data != -1).assertTrue();
}).catch((err) => { }).catch((err) => {
expect(err.code == 29360210).assertTrue(); expect(err.code == 29360210).assertTrue();
}); });
...@@ -323,7 +334,6 @@ describe('continuationManagerTest', function() { ...@@ -323,7 +334,6 @@ describe('continuationManagerTest', function() {
console.info("testRegisterContinuation001Begin "); console.info("testRegisterContinuation001Begin ");
continuationManager.registerContinuation(function (err, data) { continuationManager.registerContinuation(function (err, data) {
expect(err.code == 0).assertTrue(); expect(err.code == 0).assertTrue();
expect(data - token == 1).assertTrue();
done(); done();
}); });
} catch (e) { } catch (e) {
...@@ -404,7 +414,6 @@ describe('continuationManagerTest', function() { ...@@ -404,7 +414,6 @@ describe('continuationManagerTest', function() {
}; };
continuationManager.registerContinuation(continuationExtraParams, function(err, data) { continuationManager.registerContinuation(continuationExtraParams, function(err, data) {
expect(err.code == 0).assertTrue(); expect(err.code == 0).assertTrue();
expect(data - token == 1).assertTrue();
done(); done();
}); });
} catch (e) { } catch (e) {
...@@ -431,7 +440,6 @@ describe('continuationManagerTest', function() { ...@@ -431,7 +440,6 @@ describe('continuationManagerTest', function() {
}; };
continuationManager.registerContinuation(continuationExtraParams, function(err, data) { continuationManager.registerContinuation(continuationExtraParams, function(err, data) {
expect(err.code == 0).assertTrue(); expect(err.code == 0).assertTrue();
expect(data - token == 1).assertTrue();
done(); done();
}); });
} catch (e) { } catch (e) {
...@@ -457,7 +465,7 @@ describe('continuationManagerTest', function() { ...@@ -457,7 +465,7 @@ describe('continuationManagerTest', function() {
authInfo: {"name": "authInfo","length": 8} authInfo: {"name": "authInfo","length": 8}
}; };
continuationManager.registerContinuation(continuationExtraParams).then((data) => { continuationManager.registerContinuation(continuationExtraParams).then((data) => {
expect(data - token == 1).assertTrue(); expect(data != -1).assertTrue();
}).catch((err) => { }).catch((err) => {
expect(err.code == 16600002).assertTrue(); expect(err.code == 16600002).assertTrue();
}); });
...@@ -483,7 +491,7 @@ describe('continuationManagerTest', function() { ...@@ -483,7 +491,7 @@ describe('continuationManagerTest', function() {
authInfo: {"name": "authInfo","length": 8} authInfo: {"name": "authInfo","length": 8}
}; };
continuationManager.registerContinuation(continuationExtraParams).then((data) => { continuationManager.registerContinuation(continuationExtraParams).then((data) => {
expect(data - token == 1).assertTrue(); expect(data != -1).assertTrue();
}).catch((err) => { }).catch((err) => {
expect(err.code == 16600002).assertTrue(); expect(err.code == 16600002).assertTrue();
}); });
...@@ -509,7 +517,7 @@ describe('continuationManagerTest', function() { ...@@ -509,7 +517,7 @@ describe('continuationManagerTest', function() {
authInfo: {} authInfo: {}
}; };
continuationManager.registerContinuation(continuationExtraParams).then((data) => { continuationManager.registerContinuation(continuationExtraParams).then((data) => {
expect(data - token != 1).assertTrue(); expect(data != -1).assertTrue();
}).catch((err) => { }).catch((err) => {
expect(err.code == 401).assertTrue(); expect(err.code == 401).assertTrue();
}); });
...@@ -535,7 +543,7 @@ describe('continuationManagerTest', function() { ...@@ -535,7 +543,7 @@ describe('continuationManagerTest', function() {
authInfo: {"name": "authInfo","length": 8} authInfo: {"name": "authInfo","length": 8}
}; };
continuationManager.registerContinuation(continuationExtraParams).then((data) => { continuationManager.registerContinuation(continuationExtraParams).then((data) => {
expect(data - token != 1).assertTrue(); expect(data != -1).assertTrue();
}).catch((err) => { }).catch((err) => {
expect(err.code == 16600002).assertTrue(); expect(err.code == 16600002).assertTrue();
}); });
...@@ -555,7 +563,7 @@ describe('continuationManagerTest', function() { ...@@ -555,7 +563,7 @@ describe('continuationManagerTest', function() {
it('testRegisterContinuation010', 0, async function(done) { it('testRegisterContinuation010', 0, async function(done) {
try { try {
continuationManager.registerContinuation().then((data) => { continuationManager.registerContinuation().then((data) => {
expect(data - token == 1).assertTrue(); expect(data != -1).assertTrue();
}).catch((err) => { }).catch((err) => {
expect(err.code == 16600002).assertTrue(); expect(err.code == 16600002).assertTrue();
}); });
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册