-
Notifications
You must be signed in to change notification settings - Fork 143
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(core): move create-account integration tests (#3817)
* test(core): move update-language tests to bats and new integration * test(core): move create-account tests to new integration * test(core): remove redundant 'createAccount' helper
- Loading branch information
Showing
10 changed files
with
120 additions
and
98 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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
load "../../helpers/user.bash" | ||
|
||
setup_file() { | ||
create_user 'alice' | ||
} | ||
|
||
@test "account: updates language" { | ||
local new_language="de" | ||
|
||
exec_graphql 'alice' 'user-details' | ||
language="$(graphql_output '.data.me.language')" | ||
[[ "$language" == "" ]] || exit 1 | ||
|
||
local variables=$( | ||
jq -n \ | ||
--arg language "$new_language" \ | ||
'{input: {language: $language}}' | ||
) | ||
exec_graphql 'alice' 'user-update-language' "$variables" | ||
changed_language="$(graphql_output '.data.userUpdateLanguage.user.language')" | ||
[[ "$changed_language" == "$new_language" ]] || exit 1 | ||
|
||
exec_graphql 'alice' 'user-details' | ||
language="$(graphql_output '.data.me.language')" | ||
[[ "$language" == "$new_language" ]] || exit 1 | ||
} |
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,6 @@ | ||
query userDetails { | ||
me { | ||
id | ||
language | ||
} | ||
} |
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,11 @@ | ||
mutation userUpdateLanguage($input: UserUpdateLanguageInput!) { | ||
userUpdateLanguage(input: $input) { | ||
user { | ||
language | ||
} | ||
errors { | ||
code | ||
message | ||
} | ||
} | ||
} |
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
22 changes: 22 additions & 0 deletions
22
core/api/test/integration/app/user/update-language.spec.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,22 @@ | ||
import { Users } from "@/app" | ||
import { InvalidLanguageError } from "@/domain/errors" | ||
|
||
import { createUserAndWalletFromPhone, getUserIdByPhone, randomPhone } from "test/helpers" | ||
|
||
let userId: UserId | ||
const phone = randomPhone() | ||
|
||
beforeAll(async () => { | ||
await createUserAndWalletFromPhone(phone) | ||
userId = await getUserIdByPhone(phone) | ||
}) | ||
|
||
describe("UserUpdateLanguage", () => { | ||
it("fails with invalid language", async () => { | ||
const result = await Users.updateLanguage({ | ||
userId: userId, | ||
language: "Klingon", | ||
}) | ||
expect(result).toBeInstanceOf(InvalidLanguageError) | ||
}) | ||
}) |
48 changes: 0 additions & 48 deletions
48
core/api/test/legacy-integration/app/users/update-language.spec.ts
This file was deleted.
Oops, something went wrong.
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