From d94e89567481c39b0513dcce3ad2c43d720a6c2e Mon Sep 17 00:00:00 2001 From: steffnay Date: Fri, 8 Oct 2021 14:15:21 -0700 Subject: [PATCH] fix: update table.create to not reset id --- src/service-object.ts | 3 --- test/service-object.ts | 4 ++-- 2 files changed, 2 insertions(+), 5 deletions(-) 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(); });