-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: code completions for identity and built-in types (#1268)
- Loading branch information
Showing
34 changed files
with
1,480 additions
and
317 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,12 +40,12 @@ jobs: | |
|
||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
token: ${{ secrets.NPM_TOKEN }} | ||
node-version: 18.12.1 | ||
token: ${{ secrets.NPM_TOKEN }} | ||
|
||
- uses: pnpm/[email protected] | ||
with: | ||
version: 8.5.1 | ||
version: 8.10.0 | ||
|
||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
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
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
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 |
---|---|---|
|
@@ -223,3 +223,91 @@ test("update - @set with backlinks and no user backlink", async () => { | |
message: "field 'isActive' cannot be null", | ||
}); | ||
}); | ||
|
||
test("create - @set with identity fields", async () => { | ||
const { identityCreated } = await actions.authenticate({ | ||
createIfNotExists: true, | ||
emailPassword: { | ||
email: "[email protected]", | ||
password: "1234", | ||
}, | ||
}); | ||
expect(identityCreated).toBeTruthy(); | ||
|
||
const identity = await models.identity.update( | ||
{ email: "[email protected]" }, | ||
{ externalId: "extId" } | ||
); | ||
|
||
const org = await models.organisation.create({ | ||
name: "Keel", | ||
isActive: true, | ||
}); | ||
const user = await models.user.create({ | ||
name: "Keelson", | ||
identityId: identity!.id, | ||
organisationId: org.id, | ||
}); | ||
|
||
const extension = await actions | ||
.withIdentity(identity!) | ||
.createExt({ n: "Keelson" }); | ||
|
||
expect(extension.name).toEqual("Keelson"); | ||
expect(extension.identity1Id).toEqual(identity?.id); | ||
expect(extension.identity2Id).toEqual(identity?.id); | ||
expect(extension.user1Id).toEqual(user.id); | ||
expect(extension.user2Id).toEqual(user.id); | ||
expect(extension.email).toEqual(identity?.email); | ||
expect(extension.isVerified).toEqual(identity?.emailVerified); | ||
expect(extension.issuer).toEqual(identity?.issuer); | ||
// https://linear.app/keel/issue/KE-1192/datetime-precision-loss | ||
//expect(extension.signedUpAt).toEqual(identity?.createdAt); | ||
expect(extension.externalId).toEqual(identity?.externalId); | ||
}); | ||
|
||
test("update - @set with identity fields", async () => { | ||
const { identityCreated } = await actions.authenticate({ | ||
createIfNotExists: true, | ||
emailPassword: { | ||
email: "[email protected]", | ||
password: "1234", | ||
}, | ||
}); | ||
expect(identityCreated).toBeTruthy(); | ||
|
||
const identity = await models.identity.update( | ||
{ email: "[email protected]" }, | ||
{ externalId: "extId" } | ||
); | ||
|
||
const org = await models.organisation.create({ | ||
name: "Keel", | ||
isActive: true, | ||
}); | ||
const user = await models.user.create({ | ||
name: "Keelson", | ||
identityId: identity!.id, | ||
organisationId: org.id, | ||
}); | ||
|
||
const { id } = await actions | ||
.withIdentity(identity!) | ||
.createExt({ n: "Keelson" }); | ||
|
||
const extension = await actions | ||
.withIdentity(identity!) | ||
.updateExt({ where: { id: id }, values: { n: "Keelson" } }); | ||
|
||
expect(extension.name).toEqual("Keelson"); | ||
expect(extension.identity1Id).toEqual(identity?.id); | ||
expect(extension.identity2Id).toEqual(identity?.id); | ||
expect(extension.user1Id).toEqual(user.id); | ||
expect(extension.user2Id).toEqual(user.id); | ||
expect(extension.email).toEqual(identity?.email); | ||
expect(extension.isVerified).toEqual(identity?.emailVerified); | ||
expect(extension.issuer).toEqual(identity?.issuer); | ||
// https://linear.app/keel/issue/KE-1192/datetime-precision-loss | ||
//expect(extension.signedUpAt).toEqual(identity?.createdAt); | ||
expect(extension.externalId).toEqual(identity?.externalId); | ||
}); |
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
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
Oops, something went wrong.