-
-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(zmodel): clean up logic for detecting what attributes should be i…
…nherited from base models
- Loading branch information
Showing
4 changed files
with
134 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
tests/integration/tests/enhancements/with-delegate/issue-1243.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import { loadSchema } from '@zenstackhq/testtools'; | ||
|
||
describe('Regression for issue 1243', () => { | ||
it('uninheritable fields', async () => { | ||
const schema = ` | ||
model Base { | ||
id String @id @default(cuid()) | ||
type String | ||
foo String | ||
@@delegate(type) | ||
@@index([foo]) | ||
@@map('base') | ||
@@unique([foo]) | ||
} | ||
model Item1 extends Base { | ||
x String | ||
} | ||
model Item2 extends Base { | ||
y String | ||
} | ||
`; | ||
|
||
await loadSchema(schema, { | ||
enhancements: ['delegate'], | ||
}); | ||
}); | ||
|
||
it('multiple id fields', async () => { | ||
const schema = ` | ||
model Base { | ||
id1 String | ||
id2 String | ||
type String | ||
@@delegate(type) | ||
@@id([id1, id2]) | ||
} | ||
model Item1 extends Base { | ||
x String | ||
} | ||
model Item2 extends Base { | ||
y String | ||
} | ||
`; | ||
|
||
await loadSchema(schema, { | ||
enhancements: ['delegate'], | ||
}); | ||
}); | ||
}); |