Skip to content

Commit

Permalink
use new vitest syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
YaroShkvorets committed Dec 27, 2024
1 parent 0d56624 commit 131cbea
Show file tree
Hide file tree
Showing 10 changed files with 257 additions and 272 deletions.
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
2 changes: 1 addition & 1 deletion packages/cli/src/protocols/ethereum/codegen/abi.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ let tempdir: string;
let abi: ABI;
let generatedTypes: any[] = [];

describe.concurrent('ABI code generation', () => {
describe('ABI code generation', { concurrent: true }, () => {
beforeAll(async () => {
tempdir = await fs.mkdtemp('abi-codegen');

Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/validation/schema.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { describe, expect, test } from 'vitest';
import { typeSuggestion } from './schema.js';

describe.concurrent('Schema validation', () => {
describe('Schema validation', { concurrent: true }, () => {
test('Type suggestions', () => {
expect(typeSuggestion('Address')).toEqual('Bytes');
expect(typeSuggestion('address')).toEqual('Bytes');
Expand Down
9 changes: 5 additions & 4 deletions packages/cli/tests/cli/init.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@ import { cliTest } from './util';

// we run the tests sequentially because each init command installs deps with the
// same package manager and we want to avoid race conditions on the deps cache
describe.sequential(
describe(
'Init',
{
sequential: true,
timeout: 100_000,
},
() => {
const baseDir = path.join(__dirname, 'init');

Expand Down Expand Up @@ -238,7 +242,4 @@ describe.sequential(
);
});
},
{
timeout: 60_000,
},
);
Loading

0 comments on commit 131cbea

Please sign in to comment.