@graphprotocol/graph-cli
Version:
CLI for building for and deploying to The Graph
48 lines (47 loc) • 2.54 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const studio_1 = require("./studio");
describe('Version Command Helpers', () => {
describe('validateStudioNetwork', () => {
describe("When it's studio", () => {
test("And it's Ethereum mainnet", () => {
expect(() => (0, studio_1.validateStudioNetwork)({
studio: true,
network: 'mainnet',
})).not.toThrow(new Error(`The Subgraph Studio only allows subgraphs for these networks: ${studio_1.allowedStudioNetworks.join(', ')}`));
});
test("And it's Gnosis chain", () => {
expect(() => (0, studio_1.validateStudioNetwork)({
studio: true,
network: 'gnosis',
})).not.toThrow(new Error(`The Subgraph Studio only allows subgraphs for these networks: ${studio_1.allowedStudioNetworks.join(', ')}`));
});
test('And no network is passed', () => {
expect(() => (0, studio_1.validateStudioNetwork)({
studio: true,
network: undefined,
})).not.toThrow(new Error(`The Subgraph Studio only allows subgraphs for these networks: ${studio_1.allowedStudioNetworks.join(', ')}`));
});
test("And it's NOT an allowed network", () => {
expect(() => (0, studio_1.validateStudioNetwork)({
product: 'subgraph-studio',
network: 'moonriver',
})).toThrow(new Error(`The Subgraph Studio only allows subgraphs for these networks: ${studio_1.allowedStudioNetworks.join(', ')}`));
});
});
describe("When it's NOT studio", () => {
test("And it's Rinkeby", () => {
expect(() => (0, studio_1.validateStudioNetwork)({
studio: false,
network: 'rinkeby',
})).not.toThrow(new Error(`The Subgraph Studio only allows subgraphs for these networks: ${studio_1.allowedStudioNetworks.join(', ')}`));
});
test("And it's NOT an allowed network", () => {
expect(() => (0, studio_1.validateStudioNetwork)({
product: 'hosted-service',
network: 'celo',
})).not.toThrow(new Error(`The Subgraph Studio only allows subgraphs for these networks: ${studio_1.allowedStudioNetworks.join(', ')}`));
});
});
});
});