Skip to content

Commit

Permalink
Tests cleanup (#1886)
Browse files Browse the repository at this point in the history
* allow running tests workflows from forks

* remove unused snapshots

* use new vitest syntax
  • Loading branch information
YaroShkvorets authored Dec 27, 2024
1 parent 75e76fa commit 68b12b5
Show file tree
Hide file tree
Showing 12 changed files with 258 additions and 753 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
push:
branches:
- 'main'
pull_request:
pull_request_target:

jobs:
lint:
Expand Down
16 changes: 8 additions & 8 deletions packages/cli/src/codegen/schema.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const testEntity = async (generatedTypes: any[], expectedEntity: any) => {
expect(methods.length).toBe(expectedEntity.methods.length);
};

describe.concurrent('Schema code generator', () => {
describe('Schema code generator', { concurrent: true }, () => {
test('Should generate nothing for non entity types', () => {
const codegen = createSchemaCodeGen(`
type Foo {
Expand Down Expand Up @@ -217,7 +217,7 @@ describe.concurrent('Schema code generator', () => {
return 0
} else {
return value.toI32()
}
}
`,
},
{
Expand Down Expand Up @@ -313,7 +313,7 @@ describe.concurrent('Schema code generator', () => {
params: [],
returnType: new NamedType('WalletLoader'),
body: `
return new WalletLoader("Account", this.get('id')!.toString(), "wallets")
return new WalletLoader("Account", this.get('id')!.toString(), "wallets")
`,
},
],
Expand Down Expand Up @@ -566,7 +566,7 @@ describe.concurrent('Schema code generator', () => {
id: Bytes!
related: [RelatedBytes!]! @derivedFrom(field: "related")
}
type RelatedBytes @entity {
id: ID!
related: WithBytes!
Expand Down Expand Up @@ -647,17 +647,17 @@ describe.concurrent('Schema code generator', () => {
test('no derived loader for interface', () => {
const codegen = createSchemaCodeGen(`
interface IExample {
id: ID!
id: ID!
main: Main!
num: Int!
}
type Example1 implements IExample @entity {
id: ID!
id: ID!
main: Main!
num: Int!
}
type Main @entity {
id: ID!
examples: [IExample!]! @derivedFrom(field: "main")
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/codegen/types/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { describe, expect, test } from 'vitest';
import * as codegen from './index.js';

describe.concurrent('ethereum.Value -> AssemblyScript', () => {
describe('ethereum.Value -> AssemblyScript', { concurrent: true }, () => {
// Scalar values

test('address -> Address', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/codegen/util.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { describe, expect, test } from 'vitest';
import { disambiguateNames, unrollTuple } from './util.js';

describe.concurrent('Codegen utilities', () => {
describe('Codegen utilities', { concurrent: true }, () => {
test('Name disambiguation', () => {
expect(
disambiguateNames({
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/command-helpers/compiler.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { describe, expect, it } from 'vitest';
import { appendApiVersionForGraph } from './compiler.js';

describe.concurrent('appendApiVersionForGraph', () => {
describe('appendApiVersionForGraph', { concurrent: true }, () => {
it('append /api/v0 to Prod URL with trailing slash', () => {
expect(appendApiVersionForGraph('https://api.thegraph.com/ipfs/')).toBe(
'https://api.thegraph.com/ipfs/api/v0',
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/command-helpers/contracts.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ const TEST_CONTRACT_START_BLOCKS = {
// },
};

describe.sequential('getStartBlockForContract', async () => {
describe('getStartBlockForContract', { sequential: true }, async () => {
const registry = await loadRegistry();
const contractService = new ContractService(registry);
for (const [network, contracts] of Object.entries(TEST_CONTRACT_START_BLOCKS)) {
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/command-helpers/version.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as loadManifestUtils from '../migrations/util/load-manifest.js';
import * as graphTsUtil from '../migrations/util/versions.js';
import { assertGraphTsVersion, assertManifestApiVersion } from './version.js';

describe.concurrent('Version Command Helpers', () => {
describe('Version Command Helpers', { concurrent: true }, () => {
beforeEach(() => {
vi.resetModules();
});
Expand Down
Loading

0 comments on commit 68b12b5

Please sign in to comment.