@graphprotocol/graph-cli 0.64.0-alpha-20231211223332-0384bb9 → 0.64.0-alpha-20231213180901-055b47e

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @graphprotocol/graph-cli
2
2
 
3
- ## 0.64.0-alpha-20231211223332-0384bb9
3
+ ## 0.64.0-alpha-20231213180901-055b47e
4
4
 
5
5
  ### Minor Changes
6
6
 
@@ -29,7 +29,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
29
29
  const assert_1 = __importDefault(require("assert"));
30
30
  const graphql = __importStar(require("graphql/language"));
31
31
  const prettier_1 = __importDefault(require("prettier"));
32
- const vitest_1 = require("vitest");
33
32
  const schema_1 = __importDefault(require("../schema"));
34
33
  const schema_2 = __importDefault(require("./schema"));
35
34
  const typescript_1 = require("./typescript");
@@ -37,25 +36,25 @@ const formatTS = (code) => prettier_1.default.format(code, { parser: 'typescript
37
36
  const createSchemaCodeGen = (schema) => new schema_2.default(new schema_1.default('', schema, graphql.parse(schema)));
38
37
  const testEntity = (generatedTypes, expectedEntity) => {
39
38
  const entity = generatedTypes.find(type => type.name === expectedEntity.name);
40
- (0, vitest_1.expect)(entity instanceof typescript_1.Class).toBe(true);
41
- (0, vitest_1.expect)(entity.extends).toBe('Entity');
42
- (0, vitest_1.expect)(entity.export).toBe(true);
39
+ expect(entity instanceof typescript_1.Class).toBe(true);
40
+ expect(entity.extends).toBe('Entity');
41
+ expect(entity.export).toBe(true);
43
42
  const { members, methods } = entity;
44
- (0, vitest_1.expect)(members).toStrictEqual(expectedEntity.members);
43
+ expect(members).toStrictEqual(expectedEntity.members);
45
44
  for (const expectedMethod of expectedEntity.methods) {
46
45
  const method = methods.find((method) => method.name === expectedMethod.name);
47
46
  // eslint-disable-next-line @typescript-eslint/no-unused-expressions
48
47
  expectedMethod.static
49
- ? (0, vitest_1.expect)(method instanceof typescript_1.StaticMethod).toBe(true)
50
- : (0, vitest_1.expect)(method instanceof typescript_1.Method).toBe(true);
51
- (0, vitest_1.expect)(method.params).toStrictEqual(expectedMethod.params);
52
- (0, vitest_1.expect)(method.returnType).toStrictEqual(expectedMethod.returnType);
53
- (0, vitest_1.expect)(formatTS(method.body)).toBe(formatTS(expectedMethod.body));
48
+ ? expect(method instanceof typescript_1.StaticMethod).toBe(true)
49
+ : expect(method instanceof typescript_1.Method).toBe(true);
50
+ expect(method.params).toStrictEqual(expectedMethod.params);
51
+ expect(method.returnType).toStrictEqual(expectedMethod.returnType);
52
+ expect(formatTS(method.body)).toBe(formatTS(expectedMethod.body));
54
53
  }
55
- (0, vitest_1.expect)(methods.length).toBe(expectedEntity.methods.length);
54
+ expect(methods.length).toBe(expectedEntity.methods.length);
56
55
  };
57
- vitest_1.describe.concurrent('Schema code generator', () => {
58
- (0, vitest_1.test)('Should generate nothing for non entity types', () => {
56
+ describe('Schema code generator', () => {
57
+ test('Should generate nothing for non entity types', () => {
59
58
  const codegen = createSchemaCodeGen(`
60
59
  type Foo {
61
60
  foobar: Int
@@ -65,9 +64,9 @@ vitest_1.describe.concurrent('Schema code generator', () => {
65
64
  barfoo: Int
66
65
  }
67
66
  `);
68
- (0, vitest_1.expect)(codegen.generateTypes().length).toBe(0);
67
+ expect(codegen.generateTypes().length).toBe(0);
69
68
  });
70
- (0, vitest_1.describe)('Should generate correct classes for each entity', () => {
69
+ describe('Should generate correct classes for each entity', () => {
71
70
  const codegen = createSchemaCodeGen(`
72
71
  # just to be sure nothing will be generated from non-entity types alongside regular ones
73
72
  type Foo {
@@ -100,13 +99,13 @@ vitest_1.describe.concurrent('Schema code generator', () => {
100
99
  }
101
100
  `);
102
101
  const generatedTypes = codegen.generateTypes();
103
- (0, vitest_1.test)('Foo is NOT an entity', () => {
102
+ test('Foo is NOT an entity', () => {
104
103
  const foo = generatedTypes.find((type) => type.name === 'Foo');
105
- (0, vitest_1.expect)(foo).toBe(undefined);
104
+ expect(foo).toBe(undefined);
106
105
  // Account and Wallet
107
- (0, vitest_1.expect)(generatedTypes.length).toBe(2);
106
+ expect(generatedTypes.length).toBe(2);
108
107
  });
109
- (0, vitest_1.test)('Account is an entity with the correct methods', () => {
108
+ test('Account is an entity with the correct methods', () => {
110
109
  testEntity(generatedTypes, {
111
110
  name: 'Account',
112
111
  members: [],
@@ -309,7 +308,7 @@ vitest_1.describe.concurrent('Schema code generator', () => {
309
308
  ],
310
309
  });
311
310
  });
312
- (0, vitest_1.test)('Wallet is an entity with the correct methods', () => {
311
+ test('Wallet is an entity with the correct methods', () => {
313
312
  testEntity(generatedTypes, {
314
313
  name: 'Wallet',
315
314
  members: [],
@@ -420,7 +419,7 @@ vitest_1.describe.concurrent('Schema code generator', () => {
420
419
  });
421
420
  });
422
421
  });
423
- (0, vitest_1.test)('Should handle references with Bytes id types', () => {
422
+ test('Should handle references with Bytes id types', () => {
424
423
  const codegen = createSchemaCodeGen(`
425
424
  interface Employee {
426
425
  id: Bytes!
@@ -543,7 +542,7 @@ vitest_1.describe.concurrent('Schema code generator', () => {
543
542
  ],
544
543
  });
545
544
  });
546
- (0, vitest_1.test)('get related method for WithBytes entity', () => {
545
+ test('get related method for WithBytes entity', () => {
547
546
  const codegen = createSchemaCodeGen(`
548
547
  type WithBytes @entity {
549
548
  id: Bytes!
@@ -623,7 +622,7 @@ vitest_1.describe.concurrent('Schema code generator', () => {
623
622
  ],
624
623
  });
625
624
  });
626
- (0, vitest_1.test)('no derived loader for interface', () => {
625
+ test('no derived loader for interface', () => {
627
626
  const codegen = createSchemaCodeGen(`
628
627
  interface IExample {
629
628
  id: ID!