Changeset View
Changeset View
Standalone View
Standalone View
js_modules/dagit/src/testing/defaultMocks.ts
import faker from 'faker'; | import faker from 'faker'; | ||||
const hyphenatedName = () => faker.random.words(2).replace(' ', '-').toLowerCase(); | const hyphenatedName = () => faker.random.words(2).replace(' ', '-').toLowerCase(); | ||||
const randomId = () => faker.random.uuid(); | const randomId = () => faker.random.uuid(); | ||||
/** | /** | ||||
* A set of default values to use for Jest GraphQL mocks. | * A set of default values to use for Jest GraphQL mocks. | ||||
* | * | ||||
* MyType: () => ({ | * MyType: () => ({ | ||||
* someField: () => 'some_value', | * someField: () => 'some_value', | ||||
* }), | * }), | ||||
*/ | */ | ||||
export const defaultMocks = { | export const defaultMocks = { | ||||
Pipeline: () => ({ | Pipeline: () => ({ | ||||
id: randomId, | |||||
name: hyphenatedName, | name: hyphenatedName, | ||||
pipelineSnapshotId: randomId, | pipelineSnapshotId: randomId, | ||||
}), | }), | ||||
Query: () => ({ | Query: () => ({ | ||||
version: () => 'x.y.z', | version: () => 'x.y.z', | ||||
}), | }), | ||||
Repository: () => ({ | Repository: () => ({ | ||||
id: randomId, | id: randomId, | ||||
name: hyphenatedName, | name: hyphenatedName, | ||||
}), | }), | ||||
RepositoryLocation: () => ({ | RepositoryLocation: () => ({ | ||||
id: randomId, | |||||
name: hyphenatedName, | name: hyphenatedName, | ||||
}), | }), | ||||
ScheduleDefinition: () => ({ | ScheduleDefinition: () => ({ | ||||
name: hyphenatedName, | name: hyphenatedName, | ||||
}), | }), | ||||
Solid: () => ({ | Solid: () => ({ | ||||
name: hyphenatedName, | name: hyphenatedName, | ||||
}), | }), | ||||
}; | }; |