Skip to content

Commit

Permalink
chore: add chai expect linter rules and fix tests (#5408)
Browse files Browse the repository at this point in the history
  • Loading branch information
twelvemo authored Nov 14, 2023
1 parent 9edc9ac commit 8260ab7
Show file tree
Hide file tree
Showing 10 changed files with 27 additions and 13 deletions.
6 changes: 3 additions & 3 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"extends": [".eslintrc.autogenerated.cjs", "plugin:@typescript-eslint/recommended", "plugin:prettier/recommended"],
"extends": [".eslintrc.autogenerated.cjs", "plugin:@typescript-eslint/recommended", "plugin:prettier/recommended", "plugin:chai-expect/recommended"],
"root": true,
"plugins": ["unused-imports", "mocha", "header"],
"plugins": ["unused-imports", "mocha", "header", "chai-expect"],
"ignorePatterns": ["*.d.ts*", "garden-sea/tmp/**/*"],
"rules": {
"@typescript-eslint/no-floating-promises": "warn",
Expand Down Expand Up @@ -52,6 +52,6 @@
]],
"@typescript-eslint/no-unused-vars": ["error", { "argsIgnorePattern": "^_", "varsIgnorePattern": "^_", "destructuredArrayIgnorePattern": "^_" }],
"@typescript-eslint/consistent-type-imports": "error",
"@typescript-eslint/no-explicit-any": "warn"
"@typescript-eslint/no-explicit-any": "warn",
}
}
2 changes: 1 addition & 1 deletion core/test/integ/src/plugins/kubernetes/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ describe("KubeApi", () => {
retryOpts: { maxRetries: 0, minTimeoutMs: 0 },
}),
(err) => {
expect(err instanceof KubernetesError)
expect(err).to.be.instanceOf(KubernetesError)
}
)
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -800,7 +800,7 @@ describe("kubernetes container deployment handlers", () => {
const status = statuses[action.name]
const resources = keyBy(status.detail?.detail["remoteResources"], "kind")

expect(status.state === "ready")
expect(status.state).eql("ready")
expect(resources.Deployment.spec.template.spec.volumes).to.eql([
{ name: "test", persistentVolumeClaim: { claimName: "volume-module" } },
])
Expand Down
2 changes: 1 addition & 1 deletion core/test/integ/src/plugins/kubernetes/volume/configmap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ describe("configmap module", () => {

const remoteResources = status.test.detail?.detail.remoteResources

expect(status.test.state === "ready")
expect(status.test.state).eql("ready")
expect(remoteResources.length).to.equal(1)
expect(
isSubset(remoteResources[0], {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ describe("persistentvolumeclaim", () => {

const remoteResources = statuses.test.detail?.detail.remoteResources

expect(statuses.test.state === "ready")
expect(statuses.test.state).eql("ready")
expect(remoteResources.length).to.equal(1)
expect(
isSubset(remoteResources[0], {
Expand Down
8 changes: 4 additions & 4 deletions core/test/integ/src/plugins/openshift/tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ describe.skip("OpenShift", () => {
},
opts: withDefaultGlobalOpts({ "watch": false, "force": true, "with-dependants": false }),
})
expect(result!.success)
expect(result!.success).to.be.true
})

it("should deploy a container", async () => {
Expand All @@ -59,7 +59,7 @@ describe.skip("OpenShift", () => {
},
opts: defaultDeployOpts,
})
expect(result!.success)
expect(result!.success).to.be.true
})

it("should get logs", async () => {
Expand Down Expand Up @@ -109,7 +109,7 @@ describe.skip("OpenShift", () => {
"skip-dependants": false,
}),
})
expect(result!.success)
expect(result!.success).to.be.true
})

it("should delete container deploy", async () => {
Expand All @@ -120,6 +120,6 @@ describe.skip("OpenShift", () => {
args: {},
opts: withDefaultGlobalOpts({ "dependants-first": false }),
})
expect(result!.deployStatuses["openshift-nginx-hello"].state === "ready")
expect(result!.deployStatuses["openshift-nginx-hello"].state).eql("ready")
})
})
2 changes: 1 addition & 1 deletion core/test/unit/src/graph/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ describe("graph common", () => {
spec: {},
},
]
expect(() => detectMissingDependencies(moduleConfigs))
expect(() => detectMissingDependencies(moduleConfigs)).to.not.throw
})
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ describe("buildkit build", () => {
type: "Recreate",
})

expect(result.spec.template.spec?.containers.length === 2)
expect(result.spec.template.spec?.containers.length).eql(2)

expect(result.spec.template.spec?.containers[0]).eql({
args: ["--addr", "unix:///run/buildkit/buildkitd.sock"],
Expand Down
13 changes: 13 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
"eslint-plugin-prettier": "^5.0.0",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-unused-imports": "^3.0.0",
"eslint-plugin-chai-expect": "^3.0.0",
"execa": "^8.0.1",
"fs-extra": "^9.0.0",
"handlebars": "^4.7.6",
Expand Down

0 comments on commit 8260ab7

Please sign in to comment.