-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2465392
commit 1dd2699
Showing
19 changed files
with
111 additions
and
39 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
REACT_APP_MESSAGE=staging |
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
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
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 |
---|---|---|
@@ -1,10 +1,43 @@ | ||
// import React from "react"; | ||
// import { render, screen } from "@testing-library/react"; | ||
// import App from "../App"; | ||
// const message: string = process.env.REACT_APP_MESSAGE || ""; | ||
|
||
// // 画面にHello, Reactの文字が出るかテスト | ||
// test("renders Hello, React link", () => { | ||
// render(<App />); | ||
// const linkElement = screen.getByText(new RegExp(`Hello, React ${message}`, 'i')); | ||
// expect(linkElement).toBeInTheDocument(); | ||
// }); | ||
|
||
import React from "react"; | ||
import { render, screen } from "@testing-library/react"; | ||
import App from "../App"; | ||
|
||
// 画面にLearn Reactの文字が出るかテスト | ||
test("renders learn react link", () => { | ||
// 環境変数をテストの前に設定 | ||
const originalEnv = process.env; | ||
beforeEach(() => { | ||
jest.resetModules(); // モジュールキャッシュをクリア | ||
process.env = { ...originalEnv }; // 環境変数をリセット | ||
}); | ||
|
||
afterAll(() => { | ||
process.env = originalEnv; // 全テスト後に環境変数を元に戻す | ||
}); | ||
|
||
// 画面に"Hello, React"の文字が出るかテスト(環境変数なし) | ||
test("renders 'Hello, React' text without environment variable", () => { | ||
process.env.REACT_APP_MESSAGE = ""; // 環境変数をクリア | ||
render(<App />); | ||
const linkElement = screen.getByText(/Hello, React/i); | ||
expect(linkElement).toBeInTheDocument(); | ||
}); | ||
|
||
// 画面に"Hello, React"と環境変数のメッセージが出るかテスト(環境変数あり) | ||
test("renders 'Hello, React' text with environment variable", () => { | ||
const message: string = process.env.REACT_APP_MESSAGE || ""; | ||
const testMessage: string = "Hello, React " + message; | ||
render(<App />); | ||
const linkElement = screen.getByText(/learn react/i); | ||
const linkElement = screen.getByText(new RegExp(testMessage, "i")); | ||
expect(linkElement).toBeInTheDocument(); | ||
}); |
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 @@ | ||
#!/bin/bash | ||
for env in "development" "staging" "production"; | ||
do | ||
echo $env | ||
gh | ||
done |