Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update table.create to not reset id #700

Merged
merged 1 commit into from
Oct 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions src/service-object.ts
Original file line number Diff line number Diff line change
Expand Up @@ -250,9 +250,6 @@ class ServiceObject<T = any> 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]));
Expand Down
4 changes: 2 additions & 2 deletions test/service-object.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
Expand All @@ -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();
});

Expand Down