diff --git a/src/service-object.ts b/src/service-object.ts index 7da92b1d..550d88e5 100644 --- a/src/service-object.ts +++ b/src/service-object.ts @@ -250,9 +250,6 @@ class ServiceObject extends EventEmitter { const [err, instance] = args; if (!err) { self.metadata = instance.metadata; - if (self.id && instance.metadata) { - self.id = instance.metadata.id; - } args[1] = self; // replace the created `instance` with this one. } callback!(...(args as {} as [Error, T])); diff --git a/test/service-object.ts b/test/service-object.ts index 6cba89b0..8d44c3b3 100644 --- a/test/service-object.ts +++ b/test/service-object.ts @@ -175,7 +175,7 @@ describe('ServiceObject', () => { serviceObject.create(options, done); }); - it('should update id with metadata id', done => { + it('should not change id', done => { const config = extend({}, CONFIG, { createMethod, }); @@ -193,7 +193,7 @@ describe('ServiceObject', () => { const serviceObject = new ServiceObject(config); serviceObject.create(options); - assert.strictEqual(serviceObject.id, 14); + assert.notStrictEqual(serviceObject.id, 14); done(); });