|
14 | 14 | * limitations under the License. |
15 | 15 | */ |
16 | 16 |
|
17 | | -import 'mocha'; |
18 | | -import { expect } from 'chai'; |
| 17 | +import { before, describe, it } from 'node:test'; |
| 18 | +import assert from 'node:assert'; |
19 | 19 |
|
20 | | -import { getExecOutput } from '@actions/exec'; |
21 | 20 | import { clouddeploy_v1 } from 'googleapis'; |
| 21 | +import { getExecOutput } from '@actions/exec'; |
22 | 22 | import yaml from 'js-yaml'; |
23 | 23 |
|
24 | 24 | /* eslint-disable @typescript-eslint/no-non-null-assertion */ |
25 | | -describe('E2E tests', function () { |
| 25 | +describe('E2E tests', async () => { |
26 | 26 | const { ANNOTATIONS, DELIVERY_PIPELINE, DESCRIPTION, LABELS, NAME, PROJECT_ID, REGION } = |
27 | 27 | process.env; |
28 | 28 |
|
29 | 29 | let release: clouddeploy_v1.Schema$Release; |
30 | 30 | let toolCommand: string; |
31 | 31 |
|
32 | | - before(async function () { |
| 32 | + before(async () => { |
33 | 33 | toolCommand = 'gcloud'; |
34 | 34 | if (NAME && DELIVERY_PIPELINE && PROJECT_ID && REGION) { |
35 | 35 | // get Service yaml |
@@ -62,33 +62,37 @@ describe('E2E tests', function () { |
62 | 62 | } |
63 | 63 | }); |
64 | 64 |
|
65 | | - it('has the correct annotations', function () { |
| 65 | + it('has the correct annotations', async () => { |
66 | 66 | if (ANNOTATIONS && release) { |
67 | 67 | const expected = JSON.parse(ANNOTATIONS); |
68 | | - const actual = release?.annotations; |
69 | | - expect(actual).to.deep.include(expected); |
| 68 | + const actual = release?.annotations || {}; |
| 69 | + |
| 70 | + // Filter out only the keys we care about |
| 71 | + const subset = Object.assign({}, ...Object.keys(expected).map((k) => ({ [k]: actual[k] }))); |
| 72 | + |
| 73 | + assert.deepStrictEqual(subset, expected); |
70 | 74 | } |
71 | 75 | }); |
72 | 76 |
|
73 | | - it('has the correct description', function () { |
| 77 | + it('has the correct description', async () => { |
74 | 78 | if (DESCRIPTION && release) { |
75 | 79 | const actual = release?.description; |
76 | | - expect(actual).to.deep.eq(DESCRIPTION); |
| 80 | + assert.deepStrictEqual(actual, DESCRIPTION); |
77 | 81 | } |
78 | 82 | }); |
79 | 83 |
|
80 | | - it('has the correct name', function () { |
| 84 | + it('has the correct name', async () => { |
81 | 85 | if (NAME && release) { |
82 | 86 | const actual = release?.name; |
83 | | - expect(actual).to.deep.eq(NAME); |
| 87 | + assert.deepStrictEqual(actual, NAME); |
84 | 88 | } |
85 | 89 | }); |
86 | 90 |
|
87 | | - it('has the correct labels', function () { |
| 91 | + it('has the correct labels', async () => { |
88 | 92 | if (LABELS && release) { |
89 | 93 | const expected = JSON.parse(LABELS); |
90 | 94 | const actual = release?.labels; |
91 | | - expect(actual).to.deep.eq(expected); |
| 95 | + assert.deepStrictEqual(actual, expected); |
92 | 96 | } |
93 | 97 | }); |
94 | 98 | }); |
0 commit comments