Skip to content

Commit

Permalink
fix unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
GGonryun committed Nov 13, 2024
1 parent 3aa3383 commit ca57b61
Showing 1 changed file with 26 additions and 15 deletions.
41 changes: 26 additions & 15 deletions src/commands/__tests__/ssh.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ You should have received a copy of the GNU General Public License along with @p0
import { TEST_PUBLIC_KEY } from "../../common/__mocks__/keys";
import { fetchCommand } from "../../drivers/api";
import { print1, print2 } from "../../drivers/stdio";
import { AwsSshGenerated, AwsSshPermission } from "../../plugins/aws/types";
import { sshOrScp } from "../../plugins/ssh";
import { mockGetDoc } from "../../testing/firestore";
import { sleep } from "../../util";
Expand All @@ -30,24 +31,34 @@ const mockSshOrScp = sshOrScp as jest.Mock;
const mockPrint1 = print1 as jest.Mock;
const mockPrint2 = print2 as jest.Mock;

const MOCK_REQUEST = {
status: "DONE",
generated: {
const MOCK_PERMISSION: AwsSshPermission = {
provider: "aws",
publicKey: TEST_PUBLIC_KEY,
region: "region",
alias: "alias",
resource: {
account: "accountId",
accountId: "accountId",
arn: "arn",
idcRegion: "idcRegion",
idcId: "idcId",
name: "name",
ssh: {
linuxUserName: "linuxUserName",
},
userName: "userName",
instanceId: "instanceId",
},
permission: {
spec: {
awsResourcePermission: { permission: {} },
instanceId: "instanceId",
accountId: "accountId",
region: "region",
publicKey: TEST_PUBLIC_KEY,
type: "aws",
},
};

const MOCK_GENERATED: AwsSshGenerated = {
resource: {
name: "name",
},
linuxUserName: "linuxUserName",
};

const MOCK_REQUEST = {
status: "DONE",
generated: MOCK_GENERATED,
permission: MOCK_PERMISSION,
};

mockGetDoc({
Expand Down

0 comments on commit ca57b61

Please sign in to comment.