Skip to content

Commit af40189

Browse files
committed
Updated to latest codify schema and codify plugin lib
1 parent d330da4 commit af40189

4 files changed

Lines changed: 14 additions & 26 deletions

File tree

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "codify-plugin-test",
3-
"version": "0.0.4",
3+
"version": "0.0.5",
44
"description": "",
55
"main": "dist/index.js",
66
"typings": "dist/index.d.ts",
@@ -15,7 +15,7 @@
1515
"dependencies": {
1616
"ajv": "^8.12.0",
1717
"ajv-formats": "^3.0.1",
18-
"codify-schemas": "1.0.38"
18+
"codify-schemas": "1.0.42"
1919
},
2020
"devDependencies": {
2121
"@oclif/prettier-config": "^0.2.1",
@@ -28,7 +28,7 @@
2828
"tsx": "^4.7.3",
2929
"typescript": "^5",
3030
"vitest": "^1.4.0",
31-
"codify-plugin-lib": "1.0.59"
31+
"codify-plugin-lib": "1.0.73"
3232
},
3333
"engines": {
3434
"node": ">=18.0.0"

src/plugin-tester.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ export class PluginTester {
6565

6666
const validate = await this.validate({ configs });
6767

68-
const invalidConfigs = validate.validationResults.filter((v) => !v.isValid)
68+
const invalidConfigs = validate.resourceValidations.filter((v) => !v.isValid)
6969
if (invalidConfigs.length > 0) {
7070
throw new Error(`The following configs did not validate:\n ${JSON.stringify(invalidConfigs, null, 2)}`)
7171
}

test/plugin-tester.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ describe('Plugin tester integration tests', () => {
2727
}]
2828
})
2929

30-
expect(result.validationResults).toMatchObject([{
30+
expect(result.resourceValidations).toMatchObject([{
3131
isValid: true,
3232
}])
3333
})

test/test-plugin.ts

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import { Plan, Plugin, Resource, ValidationResult, runPlugin } from 'codify-plugin-lib';
1+
import { Plugin, Resource, runPlugin } from 'codify-plugin-lib';
22
import { StringIndexedObject } from 'codify-schemas';
33

4-
export interface TestConfig extends StringIndexedObject{
4+
export interface TestConfig extends StringIndexedObject {
55
propA: string;
66
propB: number;
77
propC: string;
@@ -14,12 +14,12 @@ export class TestResource extends Resource<TestConfig> {
1414
});
1515
}
1616

17-
async applyCreate(plan: Plan<TestConfig>): Promise<void> {}
17+
async applyCreate(): Promise<void> {}
1818

19-
async applyDestroy(plan: Plan<TestConfig>): Promise<void> {}
19+
async applyDestroy(): Promise<void> {}
2020

21-
async refresh(keys: Map<string, unknown>): Promise<Partial<TestConfig> | null> {
22-
if (keys.has('propD')) {
21+
async refresh(parameters: Partial<TestConfig>): Promise<Partial<TestConfig> | null> {
22+
if (parameters.propD) {
2323
throw new Error('Prop D is included');
2424
}
2525

@@ -29,12 +29,6 @@ export class TestResource extends Resource<TestConfig> {
2929
propC: 'c',
3030
};
3131
}
32-
33-
async validateResource(config: unknown): Promise<ValidationResult> {
34-
return {
35-
isValid: true
36-
}
37-
}
3832
}
3933

4034
export class TestUninstallResource extends Resource<TestConfig> {
@@ -44,19 +38,13 @@ export class TestUninstallResource extends Resource<TestConfig> {
4438
});
4539
}
4640

47-
async applyCreate(plan: Plan<TestConfig>): Promise<void> {}
41+
async applyCreate(): Promise<void> {}
4842

49-
async applyDestroy(plan: Plan<TestConfig>): Promise<void> {}
43+
async applyDestroy(): Promise<void> {}
5044

51-
async refresh(keys: Map<string, unknown>): Promise<Partial<TestConfig> | null> {
45+
async refresh(): Promise<Partial<TestConfig> | null> {
5246
return null;
5347
}
54-
55-
async validateResource(config: unknown): Promise<ValidationResult> {
56-
return {
57-
isValid: true
58-
}
59-
}
6048
}
6149

6250
function buildPlugin(): Plugin {

0 commit comments

Comments
 (0)