Files
kami-parse-server/spec/defaultGraphQLTypes.spec.js

609 lines
20 KiB
JavaScript
Raw Normal View History

GraphQL Support (#5674) * GraphQL boilerplate * Create GraphQL schema without using gql * Introducing loaders * Generic create mutation * create mutation is now working for any data type * Create mutation for each parse class - partial * Adding more data types to the class * Get parse class query * Generic get query * Generic delete mutation * Parse class delete mutation * Parse class find mutation * Generic update mutation * Parse class update mutation * Fixing initialization problems * Installing node-fetch again * Basic implementation for Pointer * Constructor tests * API tests boilerplate * _getGraphQLOptions * applyGraphQL tests * GraphQL API initial tests * applyPlayground tests * createSubscriptions tests * ParseGrapjQLSchema tests file * ParseGraphQLSchema tests * TypeValidationError * TypeValidationError * parseStringValue test * parseIntValue tests * parseBooleanValue tests * parseDateValue tests * parseValue tests * parseListValues tests * parseObjectFields tests * Default types tests * Get tests * First permission test at generic Get operation * Fixing prepare data * ApolloClient does not work well with different queries runnning in paralell with different headers * ApolloClient does not work well with different queries runnning in paralell with different headers * User 3 tests * User 3 tests * Get level permission tests * Get User specific tests * Get now support keys argument * Get now supports include argument * Get now supports read preferences * Adding tests for read preference enum type * Find basic test * Find permissions test * Find where argument test * Order, skip and limit tests * Error handler * Find now supports count * Test for FindResult type * Improving find count * Find max limit test * Find now supports keys, include and includeAll * Find now supports read preferences * Basic Create test * Generic create mutation tests * Basic update test * UpdateResult object type test * Update level permissions tests * Error handler for default mutations * Delete mutation basic test * Delete mutation level permission tests * Test for string * String test * Date test * Pointer test * Relation tests * Changing objects mutations location * Changing objects queries location * Create file mutation * Test for file fields * Test for null values * Changing parse classes operations location * Objects mutations refactoring * Class specific create object mutation now working * Update class specific mutation now working * Specific class delete mutation now working * Get class specific mutation now working * Find class specific query now working without where and sort * Find query for custom classes working with where partially * Almost all data types working for specfic class find where * Now only missing relation, geopoint, file and ACL * Additional tests with Parse classes queries and mutations * Now only missing relation, geopoint, file and ACL * Files * Fiels are now working * Excluding missing order test temporarly * Refactoring dates * Refactoring files * Default types review * Refeactoring object queries * Refactoring class scalar type * Refactoring class types * Geo queries are now working * Fixing centerSphere * Allow sort on class specific queries * Supporting bytes * ACL constraint * Temporarly removing xit tests * Fixing some tests because of schema cache * Removing session token from users * Parse.User queries and mutations * Remove test using fit * Fixing include test that was failing because of schema cache * Fixing count test for postgres. Postgres does not count with where={} (legacy problem). We should solve it later * Fix null values test for postgres. It is evaluating null as undefined (legacy problem) and we should fix is later. * Fixing schema change test that was failing because of schema cache * Add GraphQL File type parseLiteral tests * Refeactoring users * Including sign up mutation * Fix failing test * Improve default GraphQL types tests coverage * Including some tests for data types * Including additional pointer test: * Fixing some tests * more data type tests * Include Bytes and Polygon data types tests * Polygons test * Merging other tests * Fixing some postgres tests
2019-06-19 17:19:47 -07:00
const { Kind } = require('graphql');
const {
TypeValidationError,
parseStringValue,
parseIntValue,
parseFloatValue,
parseBooleanValue,
parseDateIsoValue,
parseValue,
parseListValues,
parseObjectFields,
BYTES,
DATE,
FILE,
} = require('../lib/GraphQL/loaders/defaultGraphQLTypes');
function createValue(kind, value, values, fields) {
return {
kind,
value,
values,
fields,
};
}
function createObjectField(name, value) {
return {
name: {
value: name,
},
value,
};
}
describe('defaultGraphQLTypes', () => {
describe('TypeValidationError', () => {
it('should be an error with specific message', () => {
const typeValidationError = new TypeValidationError('somevalue', 'sometype');
GraphQL Support (#5674) * GraphQL boilerplate * Create GraphQL schema without using gql * Introducing loaders * Generic create mutation * create mutation is now working for any data type * Create mutation for each parse class - partial * Adding more data types to the class * Get parse class query * Generic get query * Generic delete mutation * Parse class delete mutation * Parse class find mutation * Generic update mutation * Parse class update mutation * Fixing initialization problems * Installing node-fetch again * Basic implementation for Pointer * Constructor tests * API tests boilerplate * _getGraphQLOptions * applyGraphQL tests * GraphQL API initial tests * applyPlayground tests * createSubscriptions tests * ParseGrapjQLSchema tests file * ParseGraphQLSchema tests * TypeValidationError * TypeValidationError * parseStringValue test * parseIntValue tests * parseBooleanValue tests * parseDateValue tests * parseValue tests * parseListValues tests * parseObjectFields tests * Default types tests * Get tests * First permission test at generic Get operation * Fixing prepare data * ApolloClient does not work well with different queries runnning in paralell with different headers * ApolloClient does not work well with different queries runnning in paralell with different headers * User 3 tests * User 3 tests * Get level permission tests * Get User specific tests * Get now support keys argument * Get now supports include argument * Get now supports read preferences * Adding tests for read preference enum type * Find basic test * Find permissions test * Find where argument test * Order, skip and limit tests * Error handler * Find now supports count * Test for FindResult type * Improving find count * Find max limit test * Find now supports keys, include and includeAll * Find now supports read preferences * Basic Create test * Generic create mutation tests * Basic update test * UpdateResult object type test * Update level permissions tests * Error handler for default mutations * Delete mutation basic test * Delete mutation level permission tests * Test for string * String test * Date test * Pointer test * Relation tests * Changing objects mutations location * Changing objects queries location * Create file mutation * Test for file fields * Test for null values * Changing parse classes operations location * Objects mutations refactoring * Class specific create object mutation now working * Update class specific mutation now working * Specific class delete mutation now working * Get class specific mutation now working * Find class specific query now working without where and sort * Find query for custom classes working with where partially * Almost all data types working for specfic class find where * Now only missing relation, geopoint, file and ACL * Additional tests with Parse classes queries and mutations * Now only missing relation, geopoint, file and ACL * Files * Fiels are now working * Excluding missing order test temporarly * Refactoring dates * Refactoring files * Default types review * Refeactoring object queries * Refactoring class scalar type * Refactoring class types * Geo queries are now working * Fixing centerSphere * Allow sort on class specific queries * Supporting bytes * ACL constraint * Temporarly removing xit tests * Fixing some tests because of schema cache * Removing session token from users * Parse.User queries and mutations * Remove test using fit * Fixing include test that was failing because of schema cache * Fixing count test for postgres. Postgres does not count with where={} (legacy problem). We should solve it later * Fix null values test for postgres. It is evaluating null as undefined (legacy problem) and we should fix is later. * Fixing schema change test that was failing because of schema cache * Add GraphQL File type parseLiteral tests * Refeactoring users * Including sign up mutation * Fix failing test * Improve default GraphQL types tests coverage * Including some tests for data types * Including additional pointer test: * Fixing some tests * more data type tests * Include Bytes and Polygon data types tests * Polygons test * Merging other tests * Fixing some postgres tests
2019-06-19 17:19:47 -07:00
expect(typeValidationError).toEqual(jasmine.any(Error));
expect(typeValidationError.message).toEqual('somevalue is not a valid sometype');
GraphQL Support (#5674) * GraphQL boilerplate * Create GraphQL schema without using gql * Introducing loaders * Generic create mutation * create mutation is now working for any data type * Create mutation for each parse class - partial * Adding more data types to the class * Get parse class query * Generic get query * Generic delete mutation * Parse class delete mutation * Parse class find mutation * Generic update mutation * Parse class update mutation * Fixing initialization problems * Installing node-fetch again * Basic implementation for Pointer * Constructor tests * API tests boilerplate * _getGraphQLOptions * applyGraphQL tests * GraphQL API initial tests * applyPlayground tests * createSubscriptions tests * ParseGrapjQLSchema tests file * ParseGraphQLSchema tests * TypeValidationError * TypeValidationError * parseStringValue test * parseIntValue tests * parseBooleanValue tests * parseDateValue tests * parseValue tests * parseListValues tests * parseObjectFields tests * Default types tests * Get tests * First permission test at generic Get operation * Fixing prepare data * ApolloClient does not work well with different queries runnning in paralell with different headers * ApolloClient does not work well with different queries runnning in paralell with different headers * User 3 tests * User 3 tests * Get level permission tests * Get User specific tests * Get now support keys argument * Get now supports include argument * Get now supports read preferences * Adding tests for read preference enum type * Find basic test * Find permissions test * Find where argument test * Order, skip and limit tests * Error handler * Find now supports count * Test for FindResult type * Improving find count * Find max limit test * Find now supports keys, include and includeAll * Find now supports read preferences * Basic Create test * Generic create mutation tests * Basic update test * UpdateResult object type test * Update level permissions tests * Error handler for default mutations * Delete mutation basic test * Delete mutation level permission tests * Test for string * String test * Date test * Pointer test * Relation tests * Changing objects mutations location * Changing objects queries location * Create file mutation * Test for file fields * Test for null values * Changing parse classes operations location * Objects mutations refactoring * Class specific create object mutation now working * Update class specific mutation now working * Specific class delete mutation now working * Get class specific mutation now working * Find class specific query now working without where and sort * Find query for custom classes working with where partially * Almost all data types working for specfic class find where * Now only missing relation, geopoint, file and ACL * Additional tests with Parse classes queries and mutations * Now only missing relation, geopoint, file and ACL * Files * Fiels are now working * Excluding missing order test temporarly * Refactoring dates * Refactoring files * Default types review * Refeactoring object queries * Refactoring class scalar type * Refactoring class types * Geo queries are now working * Fixing centerSphere * Allow sort on class specific queries * Supporting bytes * ACL constraint * Temporarly removing xit tests * Fixing some tests because of schema cache * Removing session token from users * Parse.User queries and mutations * Remove test using fit * Fixing include test that was failing because of schema cache * Fixing count test for postgres. Postgres does not count with where={} (legacy problem). We should solve it later * Fix null values test for postgres. It is evaluating null as undefined (legacy problem) and we should fix is later. * Fixing schema change test that was failing because of schema cache * Add GraphQL File type parseLiteral tests * Refeactoring users * Including sign up mutation * Fix failing test * Improve default GraphQL types tests coverage * Including some tests for data types * Including additional pointer test: * Fixing some tests * more data type tests * Include Bytes and Polygon data types tests * Polygons test * Merging other tests * Fixing some postgres tests
2019-06-19 17:19:47 -07:00
});
});
describe('parseStringValue', () => {
it('should return itself if a string', () => {
const myString = 'myString';
expect(parseStringValue(myString)).toBe(myString);
});
it('should fail if not a string', () => {
expect(() => parseStringValue()).toThrow(jasmine.stringMatching('is not a valid String'));
expect(() => parseStringValue({})).toThrow(jasmine.stringMatching('is not a valid String'));
expect(() => parseStringValue([])).toThrow(jasmine.stringMatching('is not a valid String'));
expect(() => parseStringValue(123)).toThrow(jasmine.stringMatching('is not a valid String'));
GraphQL Support (#5674) * GraphQL boilerplate * Create GraphQL schema without using gql * Introducing loaders * Generic create mutation * create mutation is now working for any data type * Create mutation for each parse class - partial * Adding more data types to the class * Get parse class query * Generic get query * Generic delete mutation * Parse class delete mutation * Parse class find mutation * Generic update mutation * Parse class update mutation * Fixing initialization problems * Installing node-fetch again * Basic implementation for Pointer * Constructor tests * API tests boilerplate * _getGraphQLOptions * applyGraphQL tests * GraphQL API initial tests * applyPlayground tests * createSubscriptions tests * ParseGrapjQLSchema tests file * ParseGraphQLSchema tests * TypeValidationError * TypeValidationError * parseStringValue test * parseIntValue tests * parseBooleanValue tests * parseDateValue tests * parseValue tests * parseListValues tests * parseObjectFields tests * Default types tests * Get tests * First permission test at generic Get operation * Fixing prepare data * ApolloClient does not work well with different queries runnning in paralell with different headers * ApolloClient does not work well with different queries runnning in paralell with different headers * User 3 tests * User 3 tests * Get level permission tests * Get User specific tests * Get now support keys argument * Get now supports include argument * Get now supports read preferences * Adding tests for read preference enum type * Find basic test * Find permissions test * Find where argument test * Order, skip and limit tests * Error handler * Find now supports count * Test for FindResult type * Improving find count * Find max limit test * Find now supports keys, include and includeAll * Find now supports read preferences * Basic Create test * Generic create mutation tests * Basic update test * UpdateResult object type test * Update level permissions tests * Error handler for default mutations * Delete mutation basic test * Delete mutation level permission tests * Test for string * String test * Date test * Pointer test * Relation tests * Changing objects mutations location * Changing objects queries location * Create file mutation * Test for file fields * Test for null values * Changing parse classes operations location * Objects mutations refactoring * Class specific create object mutation now working * Update class specific mutation now working * Specific class delete mutation now working * Get class specific mutation now working * Find class specific query now working without where and sort * Find query for custom classes working with where partially * Almost all data types working for specfic class find where * Now only missing relation, geopoint, file and ACL * Additional tests with Parse classes queries and mutations * Now only missing relation, geopoint, file and ACL * Files * Fiels are now working * Excluding missing order test temporarly * Refactoring dates * Refactoring files * Default types review * Refeactoring object queries * Refactoring class scalar type * Refactoring class types * Geo queries are now working * Fixing centerSphere * Allow sort on class specific queries * Supporting bytes * ACL constraint * Temporarly removing xit tests * Fixing some tests because of schema cache * Removing session token from users * Parse.User queries and mutations * Remove test using fit * Fixing include test that was failing because of schema cache * Fixing count test for postgres. Postgres does not count with where={} (legacy problem). We should solve it later * Fix null values test for postgres. It is evaluating null as undefined (legacy problem) and we should fix is later. * Fixing schema change test that was failing because of schema cache * Add GraphQL File type parseLiteral tests * Refeactoring users * Including sign up mutation * Fix failing test * Improve default GraphQL types tests coverage * Including some tests for data types * Including additional pointer test: * Fixing some tests * more data type tests * Include Bytes and Polygon data types tests * Polygons test * Merging other tests * Fixing some postgres tests
2019-06-19 17:19:47 -07:00
});
});
describe('parseIntValue', () => {
it('should parse to number if a string', () => {
const myString = '123';
expect(parseIntValue(myString)).toBe(123);
});
it('should fail if not a string', () => {
expect(() => parseIntValue()).toThrow(jasmine.stringMatching('is not a valid Int'));
expect(() => parseIntValue({})).toThrow(jasmine.stringMatching('is not a valid Int'));
expect(() => parseIntValue([])).toThrow(jasmine.stringMatching('is not a valid Int'));
expect(() => parseIntValue(123)).toThrow(jasmine.stringMatching('is not a valid Int'));
GraphQL Support (#5674) * GraphQL boilerplate * Create GraphQL schema without using gql * Introducing loaders * Generic create mutation * create mutation is now working for any data type * Create mutation for each parse class - partial * Adding more data types to the class * Get parse class query * Generic get query * Generic delete mutation * Parse class delete mutation * Parse class find mutation * Generic update mutation * Parse class update mutation * Fixing initialization problems * Installing node-fetch again * Basic implementation for Pointer * Constructor tests * API tests boilerplate * _getGraphQLOptions * applyGraphQL tests * GraphQL API initial tests * applyPlayground tests * createSubscriptions tests * ParseGrapjQLSchema tests file * ParseGraphQLSchema tests * TypeValidationError * TypeValidationError * parseStringValue test * parseIntValue tests * parseBooleanValue tests * parseDateValue tests * parseValue tests * parseListValues tests * parseObjectFields tests * Default types tests * Get tests * First permission test at generic Get operation * Fixing prepare data * ApolloClient does not work well with different queries runnning in paralell with different headers * ApolloClient does not work well with different queries runnning in paralell with different headers * User 3 tests * User 3 tests * Get level permission tests * Get User specific tests * Get now support keys argument * Get now supports include argument * Get now supports read preferences * Adding tests for read preference enum type * Find basic test * Find permissions test * Find where argument test * Order, skip and limit tests * Error handler * Find now supports count * Test for FindResult type * Improving find count * Find max limit test * Find now supports keys, include and includeAll * Find now supports read preferences * Basic Create test * Generic create mutation tests * Basic update test * UpdateResult object type test * Update level permissions tests * Error handler for default mutations * Delete mutation basic test * Delete mutation level permission tests * Test for string * String test * Date test * Pointer test * Relation tests * Changing objects mutations location * Changing objects queries location * Create file mutation * Test for file fields * Test for null values * Changing parse classes operations location * Objects mutations refactoring * Class specific create object mutation now working * Update class specific mutation now working * Specific class delete mutation now working * Get class specific mutation now working * Find class specific query now working without where and sort * Find query for custom classes working with where partially * Almost all data types working for specfic class find where * Now only missing relation, geopoint, file and ACL * Additional tests with Parse classes queries and mutations * Now only missing relation, geopoint, file and ACL * Files * Fiels are now working * Excluding missing order test temporarly * Refactoring dates * Refactoring files * Default types review * Refeactoring object queries * Refactoring class scalar type * Refactoring class types * Geo queries are now working * Fixing centerSphere * Allow sort on class specific queries * Supporting bytes * ACL constraint * Temporarly removing xit tests * Fixing some tests because of schema cache * Removing session token from users * Parse.User queries and mutations * Remove test using fit * Fixing include test that was failing because of schema cache * Fixing count test for postgres. Postgres does not count with where={} (legacy problem). We should solve it later * Fix null values test for postgres. It is evaluating null as undefined (legacy problem) and we should fix is later. * Fixing schema change test that was failing because of schema cache * Add GraphQL File type parseLiteral tests * Refeactoring users * Including sign up mutation * Fix failing test * Improve default GraphQL types tests coverage * Including some tests for data types * Including additional pointer test: * Fixing some tests * more data type tests * Include Bytes and Polygon data types tests * Polygons test * Merging other tests * Fixing some postgres tests
2019-06-19 17:19:47 -07:00
});
it('should fail if not an integer string', () => {
expect(() => parseIntValue('a123')).toThrow(jasmine.stringMatching('is not a valid Int'));
expect(() => parseIntValue('123.4')).toThrow(jasmine.stringMatching('is not a valid Int'));
GraphQL Support (#5674) * GraphQL boilerplate * Create GraphQL schema without using gql * Introducing loaders * Generic create mutation * create mutation is now working for any data type * Create mutation for each parse class - partial * Adding more data types to the class * Get parse class query * Generic get query * Generic delete mutation * Parse class delete mutation * Parse class find mutation * Generic update mutation * Parse class update mutation * Fixing initialization problems * Installing node-fetch again * Basic implementation for Pointer * Constructor tests * API tests boilerplate * _getGraphQLOptions * applyGraphQL tests * GraphQL API initial tests * applyPlayground tests * createSubscriptions tests * ParseGrapjQLSchema tests file * ParseGraphQLSchema tests * TypeValidationError * TypeValidationError * parseStringValue test * parseIntValue tests * parseBooleanValue tests * parseDateValue tests * parseValue tests * parseListValues tests * parseObjectFields tests * Default types tests * Get tests * First permission test at generic Get operation * Fixing prepare data * ApolloClient does not work well with different queries runnning in paralell with different headers * ApolloClient does not work well with different queries runnning in paralell with different headers * User 3 tests * User 3 tests * Get level permission tests * Get User specific tests * Get now support keys argument * Get now supports include argument * Get now supports read preferences * Adding tests for read preference enum type * Find basic test * Find permissions test * Find where argument test * Order, skip and limit tests * Error handler * Find now supports count * Test for FindResult type * Improving find count * Find max limit test * Find now supports keys, include and includeAll * Find now supports read preferences * Basic Create test * Generic create mutation tests * Basic update test * UpdateResult object type test * Update level permissions tests * Error handler for default mutations * Delete mutation basic test * Delete mutation level permission tests * Test for string * String test * Date test * Pointer test * Relation tests * Changing objects mutations location * Changing objects queries location * Create file mutation * Test for file fields * Test for null values * Changing parse classes operations location * Objects mutations refactoring * Class specific create object mutation now working * Update class specific mutation now working * Specific class delete mutation now working * Get class specific mutation now working * Find class specific query now working without where and sort * Find query for custom classes working with where partially * Almost all data types working for specfic class find where * Now only missing relation, geopoint, file and ACL * Additional tests with Parse classes queries and mutations * Now only missing relation, geopoint, file and ACL * Files * Fiels are now working * Excluding missing order test temporarly * Refactoring dates * Refactoring files * Default types review * Refeactoring object queries * Refactoring class scalar type * Refactoring class types * Geo queries are now working * Fixing centerSphere * Allow sort on class specific queries * Supporting bytes * ACL constraint * Temporarly removing xit tests * Fixing some tests because of schema cache * Removing session token from users * Parse.User queries and mutations * Remove test using fit * Fixing include test that was failing because of schema cache * Fixing count test for postgres. Postgres does not count with where={} (legacy problem). We should solve it later * Fix null values test for postgres. It is evaluating null as undefined (legacy problem) and we should fix is later. * Fixing schema change test that was failing because of schema cache * Add GraphQL File type parseLiteral tests * Refeactoring users * Including sign up mutation * Fix failing test * Improve default GraphQL types tests coverage * Including some tests for data types * Including additional pointer test: * Fixing some tests * more data type tests * Include Bytes and Polygon data types tests * Polygons test * Merging other tests * Fixing some postgres tests
2019-06-19 17:19:47 -07:00
});
});
describe('parseFloatValue', () => {
it('should parse to number if a string', () => {
expect(parseFloatValue('123')).toBe(123);
expect(parseFloatValue('123.4')).toBe(123.4);
});
it('should fail if not a string', () => {
expect(() => parseFloatValue()).toThrow(jasmine.stringMatching('is not a valid Float'));
expect(() => parseFloatValue({})).toThrow(jasmine.stringMatching('is not a valid Float'));
expect(() => parseFloatValue([])).toThrow(jasmine.stringMatching('is not a valid Float'));
GraphQL Support (#5674) * GraphQL boilerplate * Create GraphQL schema without using gql * Introducing loaders * Generic create mutation * create mutation is now working for any data type * Create mutation for each parse class - partial * Adding more data types to the class * Get parse class query * Generic get query * Generic delete mutation * Parse class delete mutation * Parse class find mutation * Generic update mutation * Parse class update mutation * Fixing initialization problems * Installing node-fetch again * Basic implementation for Pointer * Constructor tests * API tests boilerplate * _getGraphQLOptions * applyGraphQL tests * GraphQL API initial tests * applyPlayground tests * createSubscriptions tests * ParseGrapjQLSchema tests file * ParseGraphQLSchema tests * TypeValidationError * TypeValidationError * parseStringValue test * parseIntValue tests * parseBooleanValue tests * parseDateValue tests * parseValue tests * parseListValues tests * parseObjectFields tests * Default types tests * Get tests * First permission test at generic Get operation * Fixing prepare data * ApolloClient does not work well with different queries runnning in paralell with different headers * ApolloClient does not work well with different queries runnning in paralell with different headers * User 3 tests * User 3 tests * Get level permission tests * Get User specific tests * Get now support keys argument * Get now supports include argument * Get now supports read preferences * Adding tests for read preference enum type * Find basic test * Find permissions test * Find where argument test * Order, skip and limit tests * Error handler * Find now supports count * Test for FindResult type * Improving find count * Find max limit test * Find now supports keys, include and includeAll * Find now supports read preferences * Basic Create test * Generic create mutation tests * Basic update test * UpdateResult object type test * Update level permissions tests * Error handler for default mutations * Delete mutation basic test * Delete mutation level permission tests * Test for string * String test * Date test * Pointer test * Relation tests * Changing objects mutations location * Changing objects queries location * Create file mutation * Test for file fields * Test for null values * Changing parse classes operations location * Objects mutations refactoring * Class specific create object mutation now working * Update class specific mutation now working * Specific class delete mutation now working * Get class specific mutation now working * Find class specific query now working without where and sort * Find query for custom classes working with where partially * Almost all data types working for specfic class find where * Now only missing relation, geopoint, file and ACL * Additional tests with Parse classes queries and mutations * Now only missing relation, geopoint, file and ACL * Files * Fiels are now working * Excluding missing order test temporarly * Refactoring dates * Refactoring files * Default types review * Refeactoring object queries * Refactoring class scalar type * Refactoring class types * Geo queries are now working * Fixing centerSphere * Allow sort on class specific queries * Supporting bytes * ACL constraint * Temporarly removing xit tests * Fixing some tests because of schema cache * Removing session token from users * Parse.User queries and mutations * Remove test using fit * Fixing include test that was failing because of schema cache * Fixing count test for postgres. Postgres does not count with where={} (legacy problem). We should solve it later * Fix null values test for postgres. It is evaluating null as undefined (legacy problem) and we should fix is later. * Fixing schema change test that was failing because of schema cache * Add GraphQL File type parseLiteral tests * Refeactoring users * Including sign up mutation * Fix failing test * Improve default GraphQL types tests coverage * Including some tests for data types * Including additional pointer test: * Fixing some tests * more data type tests * Include Bytes and Polygon data types tests * Polygons test * Merging other tests * Fixing some postgres tests
2019-06-19 17:19:47 -07:00
});
it('should fail if not a float string', () => {
expect(() => parseIntValue('a123')).toThrow(jasmine.stringMatching('is not a valid Int'));
GraphQL Support (#5674) * GraphQL boilerplate * Create GraphQL schema without using gql * Introducing loaders * Generic create mutation * create mutation is now working for any data type * Create mutation for each parse class - partial * Adding more data types to the class * Get parse class query * Generic get query * Generic delete mutation * Parse class delete mutation * Parse class find mutation * Generic update mutation * Parse class update mutation * Fixing initialization problems * Installing node-fetch again * Basic implementation for Pointer * Constructor tests * API tests boilerplate * _getGraphQLOptions * applyGraphQL tests * GraphQL API initial tests * applyPlayground tests * createSubscriptions tests * ParseGrapjQLSchema tests file * ParseGraphQLSchema tests * TypeValidationError * TypeValidationError * parseStringValue test * parseIntValue tests * parseBooleanValue tests * parseDateValue tests * parseValue tests * parseListValues tests * parseObjectFields tests * Default types tests * Get tests * First permission test at generic Get operation * Fixing prepare data * ApolloClient does not work well with different queries runnning in paralell with different headers * ApolloClient does not work well with different queries runnning in paralell with different headers * User 3 tests * User 3 tests * Get level permission tests * Get User specific tests * Get now support keys argument * Get now supports include argument * Get now supports read preferences * Adding tests for read preference enum type * Find basic test * Find permissions test * Find where argument test * Order, skip and limit tests * Error handler * Find now supports count * Test for FindResult type * Improving find count * Find max limit test * Find now supports keys, include and includeAll * Find now supports read preferences * Basic Create test * Generic create mutation tests * Basic update test * UpdateResult object type test * Update level permissions tests * Error handler for default mutations * Delete mutation basic test * Delete mutation level permission tests * Test for string * String test * Date test * Pointer test * Relation tests * Changing objects mutations location * Changing objects queries location * Create file mutation * Test for file fields * Test for null values * Changing parse classes operations location * Objects mutations refactoring * Class specific create object mutation now working * Update class specific mutation now working * Specific class delete mutation now working * Get class specific mutation now working * Find class specific query now working without where and sort * Find query for custom classes working with where partially * Almost all data types working for specfic class find where * Now only missing relation, geopoint, file and ACL * Additional tests with Parse classes queries and mutations * Now only missing relation, geopoint, file and ACL * Files * Fiels are now working * Excluding missing order test temporarly * Refactoring dates * Refactoring files * Default types review * Refeactoring object queries * Refactoring class scalar type * Refactoring class types * Geo queries are now working * Fixing centerSphere * Allow sort on class specific queries * Supporting bytes * ACL constraint * Temporarly removing xit tests * Fixing some tests because of schema cache * Removing session token from users * Parse.User queries and mutations * Remove test using fit * Fixing include test that was failing because of schema cache * Fixing count test for postgres. Postgres does not count with where={} (legacy problem). We should solve it later * Fix null values test for postgres. It is evaluating null as undefined (legacy problem) and we should fix is later. * Fixing schema change test that was failing because of schema cache * Add GraphQL File type parseLiteral tests * Refeactoring users * Including sign up mutation * Fix failing test * Improve default GraphQL types tests coverage * Including some tests for data types * Including additional pointer test: * Fixing some tests * more data type tests * Include Bytes and Polygon data types tests * Polygons test * Merging other tests * Fixing some postgres tests
2019-06-19 17:19:47 -07:00
});
});
describe('parseBooleanValue', () => {
it('should return itself if a boolean', () => {
let myBoolean = true;
expect(parseBooleanValue(myBoolean)).toBe(myBoolean);
myBoolean = false;
expect(parseBooleanValue(myBoolean)).toBe(myBoolean);
});
it('should fail if not a boolean', () => {
expect(() => parseBooleanValue()).toThrow(jasmine.stringMatching('is not a valid Boolean'));
expect(() => parseBooleanValue({})).toThrow(jasmine.stringMatching('is not a valid Boolean'));
expect(() => parseBooleanValue([])).toThrow(jasmine.stringMatching('is not a valid Boolean'));
GraphQL Support (#5674) * GraphQL boilerplate * Create GraphQL schema without using gql * Introducing loaders * Generic create mutation * create mutation is now working for any data type * Create mutation for each parse class - partial * Adding more data types to the class * Get parse class query * Generic get query * Generic delete mutation * Parse class delete mutation * Parse class find mutation * Generic update mutation * Parse class update mutation * Fixing initialization problems * Installing node-fetch again * Basic implementation for Pointer * Constructor tests * API tests boilerplate * _getGraphQLOptions * applyGraphQL tests * GraphQL API initial tests * applyPlayground tests * createSubscriptions tests * ParseGrapjQLSchema tests file * ParseGraphQLSchema tests * TypeValidationError * TypeValidationError * parseStringValue test * parseIntValue tests * parseBooleanValue tests * parseDateValue tests * parseValue tests * parseListValues tests * parseObjectFields tests * Default types tests * Get tests * First permission test at generic Get operation * Fixing prepare data * ApolloClient does not work well with different queries runnning in paralell with different headers * ApolloClient does not work well with different queries runnning in paralell with different headers * User 3 tests * User 3 tests * Get level permission tests * Get User specific tests * Get now support keys argument * Get now supports include argument * Get now supports read preferences * Adding tests for read preference enum type * Find basic test * Find permissions test * Find where argument test * Order, skip and limit tests * Error handler * Find now supports count * Test for FindResult type * Improving find count * Find max limit test * Find now supports keys, include and includeAll * Find now supports read preferences * Basic Create test * Generic create mutation tests * Basic update test * UpdateResult object type test * Update level permissions tests * Error handler for default mutations * Delete mutation basic test * Delete mutation level permission tests * Test for string * String test * Date test * Pointer test * Relation tests * Changing objects mutations location * Changing objects queries location * Create file mutation * Test for file fields * Test for null values * Changing parse classes operations location * Objects mutations refactoring * Class specific create object mutation now working * Update class specific mutation now working * Specific class delete mutation now working * Get class specific mutation now working * Find class specific query now working without where and sort * Find query for custom classes working with where partially * Almost all data types working for specfic class find where * Now only missing relation, geopoint, file and ACL * Additional tests with Parse classes queries and mutations * Now only missing relation, geopoint, file and ACL * Files * Fiels are now working * Excluding missing order test temporarly * Refactoring dates * Refactoring files * Default types review * Refeactoring object queries * Refactoring class scalar type * Refactoring class types * Geo queries are now working * Fixing centerSphere * Allow sort on class specific queries * Supporting bytes * ACL constraint * Temporarly removing xit tests * Fixing some tests because of schema cache * Removing session token from users * Parse.User queries and mutations * Remove test using fit * Fixing include test that was failing because of schema cache * Fixing count test for postgres. Postgres does not count with where={} (legacy problem). We should solve it later * Fix null values test for postgres. It is evaluating null as undefined (legacy problem) and we should fix is later. * Fixing schema change test that was failing because of schema cache * Add GraphQL File type parseLiteral tests * Refeactoring users * Including sign up mutation * Fix failing test * Improve default GraphQL types tests coverage * Including some tests for data types * Including additional pointer test: * Fixing some tests * more data type tests * Include Bytes and Polygon data types tests * Polygons test * Merging other tests * Fixing some postgres tests
2019-06-19 17:19:47 -07:00
expect(() => parseBooleanValue(123)).toThrow(
jasmine.stringMatching('is not a valid Boolean')
);
expect(() => parseBooleanValue('true')).toThrow(
jasmine.stringMatching('is not a valid Boolean')
);
});
});
describe('parseDateValue', () => {
it('should parse to date if a string', () => {
const myDateString = '2019-05-09T23:12:00.000Z';
const myDate = new Date(Date.UTC(2019, 4, 9, 23, 12, 0, 0));
expect(parseDateIsoValue(myDateString)).toEqual(myDate);
});
it('should fail if not a string', () => {
expect(() => parseDateIsoValue()).toThrow(jasmine.stringMatching('is not a valid Date'));
expect(() => parseDateIsoValue({})).toThrow(jasmine.stringMatching('is not a valid Date'));
expect(() => parseDateIsoValue([])).toThrow(jasmine.stringMatching('is not a valid Date'));
expect(() => parseDateIsoValue(123)).toThrow(jasmine.stringMatching('is not a valid Date'));
GraphQL Support (#5674) * GraphQL boilerplate * Create GraphQL schema without using gql * Introducing loaders * Generic create mutation * create mutation is now working for any data type * Create mutation for each parse class - partial * Adding more data types to the class * Get parse class query * Generic get query * Generic delete mutation * Parse class delete mutation * Parse class find mutation * Generic update mutation * Parse class update mutation * Fixing initialization problems * Installing node-fetch again * Basic implementation for Pointer * Constructor tests * API tests boilerplate * _getGraphQLOptions * applyGraphQL tests * GraphQL API initial tests * applyPlayground tests * createSubscriptions tests * ParseGrapjQLSchema tests file * ParseGraphQLSchema tests * TypeValidationError * TypeValidationError * parseStringValue test * parseIntValue tests * parseBooleanValue tests * parseDateValue tests * parseValue tests * parseListValues tests * parseObjectFields tests * Default types tests * Get tests * First permission test at generic Get operation * Fixing prepare data * ApolloClient does not work well with different queries runnning in paralell with different headers * ApolloClient does not work well with different queries runnning in paralell with different headers * User 3 tests * User 3 tests * Get level permission tests * Get User specific tests * Get now support keys argument * Get now supports include argument * Get now supports read preferences * Adding tests for read preference enum type * Find basic test * Find permissions test * Find where argument test * Order, skip and limit tests * Error handler * Find now supports count * Test for FindResult type * Improving find count * Find max limit test * Find now supports keys, include and includeAll * Find now supports read preferences * Basic Create test * Generic create mutation tests * Basic update test * UpdateResult object type test * Update level permissions tests * Error handler for default mutations * Delete mutation basic test * Delete mutation level permission tests * Test for string * String test * Date test * Pointer test * Relation tests * Changing objects mutations location * Changing objects queries location * Create file mutation * Test for file fields * Test for null values * Changing parse classes operations location * Objects mutations refactoring * Class specific create object mutation now working * Update class specific mutation now working * Specific class delete mutation now working * Get class specific mutation now working * Find class specific query now working without where and sort * Find query for custom classes working with where partially * Almost all data types working for specfic class find where * Now only missing relation, geopoint, file and ACL * Additional tests with Parse classes queries and mutations * Now only missing relation, geopoint, file and ACL * Files * Fiels are now working * Excluding missing order test temporarly * Refactoring dates * Refactoring files * Default types review * Refeactoring object queries * Refactoring class scalar type * Refactoring class types * Geo queries are now working * Fixing centerSphere * Allow sort on class specific queries * Supporting bytes * ACL constraint * Temporarly removing xit tests * Fixing some tests because of schema cache * Removing session token from users * Parse.User queries and mutations * Remove test using fit * Fixing include test that was failing because of schema cache * Fixing count test for postgres. Postgres does not count with where={} (legacy problem). We should solve it later * Fix null values test for postgres. It is evaluating null as undefined (legacy problem) and we should fix is later. * Fixing schema change test that was failing because of schema cache * Add GraphQL File type parseLiteral tests * Refeactoring users * Including sign up mutation * Fix failing test * Improve default GraphQL types tests coverage * Including some tests for data types * Including additional pointer test: * Fixing some tests * more data type tests * Include Bytes and Polygon data types tests * Polygons test * Merging other tests * Fixing some postgres tests
2019-06-19 17:19:47 -07:00
});
it('should fail if not a date string', () => {
expect(() => parseDateIsoValue('not a date')).toThrow(
jasmine.stringMatching('is not a valid Date')
);
});
});
describe('parseValue', () => {
const someString = createValue(Kind.STRING, 'somestring');
const someInt = createValue(Kind.INT, '123');
const someFloat = createValue(Kind.FLOAT, '123.4');
const someBoolean = createValue(Kind.BOOLEAN, true);
const someOther = createValue(undefined, new Object());
const someObject = createValue(Kind.OBJECT, undefined, undefined, [
createObjectField('someString', someString),
createObjectField('someInt', someInt),
createObjectField('someFloat', someFloat),
createObjectField('someBoolean', someBoolean),
createObjectField('someOther', someOther),
createObjectField(
'someList',
createValue(Kind.LIST, undefined, [
createValue(Kind.OBJECT, undefined, undefined, [
createObjectField('someString', someString),
]),
])
),
createObjectField(
'someObject',
createValue(Kind.OBJECT, undefined, undefined, [
createObjectField('someString', someString),
])
),
]);
const someList = createValue(Kind.LIST, undefined, [
someString,
someInt,
someFloat,
someBoolean,
someObject,
someOther,
createValue(Kind.LIST, undefined, [
someString,
someInt,
someFloat,
someBoolean,
someObject,
someOther,
]),
]);
it('should parse string', () => {
expect(parseValue(someString)).toEqual('somestring');
});
it('should parse int', () => {
expect(parseValue(someInt)).toEqual(123);
});
it('should parse float', () => {
expect(parseValue(someFloat)).toEqual(123.4);
});
it('should parse boolean', () => {
expect(parseValue(someBoolean)).toEqual(true);
});
it('should parse list', () => {
expect(parseValue(someList)).toEqual([
'somestring',
123,
123.4,
true,
{
someString: 'somestring',
someInt: 123,
someFloat: 123.4,
someBoolean: true,
someOther: {},
someList: [
{
someString: 'somestring',
},
],
someObject: {
someString: 'somestring',
},
},
{},
[
'somestring',
123,
123.4,
true,
{
someString: 'somestring',
someInt: 123,
someFloat: 123.4,
someBoolean: true,
someOther: {},
someList: [
{
someString: 'somestring',
},
],
someObject: {
someString: 'somestring',
},
},
{},
],
]);
});
it('should parse object', () => {
expect(parseValue(someObject)).toEqual({
someString: 'somestring',
someInt: 123,
someFloat: 123.4,
someBoolean: true,
someOther: {},
someList: [
{
someString: 'somestring',
},
],
someObject: {
someString: 'somestring',
},
});
});
it('should return value otherwise', () => {
expect(parseValue(someOther)).toEqual(new Object());
});
});
describe('parseListValues', () => {
it('should parse to list if an array', () => {
expect(
parseListValues([
{ kind: Kind.STRING, value: 'someString' },
{ kind: Kind.INT, value: '123' },
])
).toEqual(['someString', 123]);
});
it('should fail if not an array', () => {
expect(() => parseListValues()).toThrow(jasmine.stringMatching('is not a valid List'));
expect(() => parseListValues({})).toThrow(jasmine.stringMatching('is not a valid List'));
GraphQL Support (#5674) * GraphQL boilerplate * Create GraphQL schema without using gql * Introducing loaders * Generic create mutation * create mutation is now working for any data type * Create mutation for each parse class - partial * Adding more data types to the class * Get parse class query * Generic get query * Generic delete mutation * Parse class delete mutation * Parse class find mutation * Generic update mutation * Parse class update mutation * Fixing initialization problems * Installing node-fetch again * Basic implementation for Pointer * Constructor tests * API tests boilerplate * _getGraphQLOptions * applyGraphQL tests * GraphQL API initial tests * applyPlayground tests * createSubscriptions tests * ParseGrapjQLSchema tests file * ParseGraphQLSchema tests * TypeValidationError * TypeValidationError * parseStringValue test * parseIntValue tests * parseBooleanValue tests * parseDateValue tests * parseValue tests * parseListValues tests * parseObjectFields tests * Default types tests * Get tests * First permission test at generic Get operation * Fixing prepare data * ApolloClient does not work well with different queries runnning in paralell with different headers * ApolloClient does not work well with different queries runnning in paralell with different headers * User 3 tests * User 3 tests * Get level permission tests * Get User specific tests * Get now support keys argument * Get now supports include argument * Get now supports read preferences * Adding tests for read preference enum type * Find basic test * Find permissions test * Find where argument test * Order, skip and limit tests * Error handler * Find now supports count * Test for FindResult type * Improving find count * Find max limit test * Find now supports keys, include and includeAll * Find now supports read preferences * Basic Create test * Generic create mutation tests * Basic update test * UpdateResult object type test * Update level permissions tests * Error handler for default mutations * Delete mutation basic test * Delete mutation level permission tests * Test for string * String test * Date test * Pointer test * Relation tests * Changing objects mutations location * Changing objects queries location * Create file mutation * Test for file fields * Test for null values * Changing parse classes operations location * Objects mutations refactoring * Class specific create object mutation now working * Update class specific mutation now working * Specific class delete mutation now working * Get class specific mutation now working * Find class specific query now working without where and sort * Find query for custom classes working with where partially * Almost all data types working for specfic class find where * Now only missing relation, geopoint, file and ACL * Additional tests with Parse classes queries and mutations * Now only missing relation, geopoint, file and ACL * Files * Fiels are now working * Excluding missing order test temporarly * Refactoring dates * Refactoring files * Default types review * Refeactoring object queries * Refactoring class scalar type * Refactoring class types * Geo queries are now working * Fixing centerSphere * Allow sort on class specific queries * Supporting bytes * ACL constraint * Temporarly removing xit tests * Fixing some tests because of schema cache * Removing session token from users * Parse.User queries and mutations * Remove test using fit * Fixing include test that was failing because of schema cache * Fixing count test for postgres. Postgres does not count with where={} (legacy problem). We should solve it later * Fix null values test for postgres. It is evaluating null as undefined (legacy problem) and we should fix is later. * Fixing schema change test that was failing because of schema cache * Add GraphQL File type parseLiteral tests * Refeactoring users * Including sign up mutation * Fix failing test * Improve default GraphQL types tests coverage * Including some tests for data types * Including additional pointer test: * Fixing some tests * more data type tests * Include Bytes and Polygon data types tests * Polygons test * Merging other tests * Fixing some postgres tests
2019-06-19 17:19:47 -07:00
expect(() => parseListValues('some string')).toThrow(
jasmine.stringMatching('is not a valid List')
);
expect(() => parseListValues(123)).toThrow(jasmine.stringMatching('is not a valid List'));
GraphQL Support (#5674) * GraphQL boilerplate * Create GraphQL schema without using gql * Introducing loaders * Generic create mutation * create mutation is now working for any data type * Create mutation for each parse class - partial * Adding more data types to the class * Get parse class query * Generic get query * Generic delete mutation * Parse class delete mutation * Parse class find mutation * Generic update mutation * Parse class update mutation * Fixing initialization problems * Installing node-fetch again * Basic implementation for Pointer * Constructor tests * API tests boilerplate * _getGraphQLOptions * applyGraphQL tests * GraphQL API initial tests * applyPlayground tests * createSubscriptions tests * ParseGrapjQLSchema tests file * ParseGraphQLSchema tests * TypeValidationError * TypeValidationError * parseStringValue test * parseIntValue tests * parseBooleanValue tests * parseDateValue tests * parseValue tests * parseListValues tests * parseObjectFields tests * Default types tests * Get tests * First permission test at generic Get operation * Fixing prepare data * ApolloClient does not work well with different queries runnning in paralell with different headers * ApolloClient does not work well with different queries runnning in paralell with different headers * User 3 tests * User 3 tests * Get level permission tests * Get User specific tests * Get now support keys argument * Get now supports include argument * Get now supports read preferences * Adding tests for read preference enum type * Find basic test * Find permissions test * Find where argument test * Order, skip and limit tests * Error handler * Find now supports count * Test for FindResult type * Improving find count * Find max limit test * Find now supports keys, include and includeAll * Find now supports read preferences * Basic Create test * Generic create mutation tests * Basic update test * UpdateResult object type test * Update level permissions tests * Error handler for default mutations * Delete mutation basic test * Delete mutation level permission tests * Test for string * String test * Date test * Pointer test * Relation tests * Changing objects mutations location * Changing objects queries location * Create file mutation * Test for file fields * Test for null values * Changing parse classes operations location * Objects mutations refactoring * Class specific create object mutation now working * Update class specific mutation now working * Specific class delete mutation now working * Get class specific mutation now working * Find class specific query now working without where and sort * Find query for custom classes working with where partially * Almost all data types working for specfic class find where * Now only missing relation, geopoint, file and ACL * Additional tests with Parse classes queries and mutations * Now only missing relation, geopoint, file and ACL * Files * Fiels are now working * Excluding missing order test temporarly * Refactoring dates * Refactoring files * Default types review * Refeactoring object queries * Refactoring class scalar type * Refactoring class types * Geo queries are now working * Fixing centerSphere * Allow sort on class specific queries * Supporting bytes * ACL constraint * Temporarly removing xit tests * Fixing some tests because of schema cache * Removing session token from users * Parse.User queries and mutations * Remove test using fit * Fixing include test that was failing because of schema cache * Fixing count test for postgres. Postgres does not count with where={} (legacy problem). We should solve it later * Fix null values test for postgres. It is evaluating null as undefined (legacy problem) and we should fix is later. * Fixing schema change test that was failing because of schema cache * Add GraphQL File type parseLiteral tests * Refeactoring users * Including sign up mutation * Fix failing test * Improve default GraphQL types tests coverage * Including some tests for data types * Including additional pointer test: * Fixing some tests * more data type tests * Include Bytes and Polygon data types tests * Polygons test * Merging other tests * Fixing some postgres tests
2019-06-19 17:19:47 -07:00
});
});
describe('parseObjectFields', () => {
it('should parse to list if an array', () => {
expect(
parseObjectFields([
{
name: { value: 'someString' },
value: { kind: Kind.STRING, value: 'someString' },
},
{
name: { value: 'someInt' },
value: { kind: Kind.INT, value: '123' },
},
])
).toEqual({
someString: 'someString',
someInt: 123,
});
});
it('should fail if not an array', () => {
expect(() => parseObjectFields()).toThrow(jasmine.stringMatching('is not a valid Object'));
expect(() => parseObjectFields({})).toThrow(jasmine.stringMatching('is not a valid Object'));
GraphQL Support (#5674) * GraphQL boilerplate * Create GraphQL schema without using gql * Introducing loaders * Generic create mutation * create mutation is now working for any data type * Create mutation for each parse class - partial * Adding more data types to the class * Get parse class query * Generic get query * Generic delete mutation * Parse class delete mutation * Parse class find mutation * Generic update mutation * Parse class update mutation * Fixing initialization problems * Installing node-fetch again * Basic implementation for Pointer * Constructor tests * API tests boilerplate * _getGraphQLOptions * applyGraphQL tests * GraphQL API initial tests * applyPlayground tests * createSubscriptions tests * ParseGrapjQLSchema tests file * ParseGraphQLSchema tests * TypeValidationError * TypeValidationError * parseStringValue test * parseIntValue tests * parseBooleanValue tests * parseDateValue tests * parseValue tests * parseListValues tests * parseObjectFields tests * Default types tests * Get tests * First permission test at generic Get operation * Fixing prepare data * ApolloClient does not work well with different queries runnning in paralell with different headers * ApolloClient does not work well with different queries runnning in paralell with different headers * User 3 tests * User 3 tests * Get level permission tests * Get User specific tests * Get now support keys argument * Get now supports include argument * Get now supports read preferences * Adding tests for read preference enum type * Find basic test * Find permissions test * Find where argument test * Order, skip and limit tests * Error handler * Find now supports count * Test for FindResult type * Improving find count * Find max limit test * Find now supports keys, include and includeAll * Find now supports read preferences * Basic Create test * Generic create mutation tests * Basic update test * UpdateResult object type test * Update level permissions tests * Error handler for default mutations * Delete mutation basic test * Delete mutation level permission tests * Test for string * String test * Date test * Pointer test * Relation tests * Changing objects mutations location * Changing objects queries location * Create file mutation * Test for file fields * Test for null values * Changing parse classes operations location * Objects mutations refactoring * Class specific create object mutation now working * Update class specific mutation now working * Specific class delete mutation now working * Get class specific mutation now working * Find class specific query now working without where and sort * Find query for custom classes working with where partially * Almost all data types working for specfic class find where * Now only missing relation, geopoint, file and ACL * Additional tests with Parse classes queries and mutations * Now only missing relation, geopoint, file and ACL * Files * Fiels are now working * Excluding missing order test temporarly * Refactoring dates * Refactoring files * Default types review * Refeactoring object queries * Refactoring class scalar type * Refactoring class types * Geo queries are now working * Fixing centerSphere * Allow sort on class specific queries * Supporting bytes * ACL constraint * Temporarly removing xit tests * Fixing some tests because of schema cache * Removing session token from users * Parse.User queries and mutations * Remove test using fit * Fixing include test that was failing because of schema cache * Fixing count test for postgres. Postgres does not count with where={} (legacy problem). We should solve it later * Fix null values test for postgres. It is evaluating null as undefined (legacy problem) and we should fix is later. * Fixing schema change test that was failing because of schema cache * Add GraphQL File type parseLiteral tests * Refeactoring users * Including sign up mutation * Fix failing test * Improve default GraphQL types tests coverage * Including some tests for data types * Including additional pointer test: * Fixing some tests * more data type tests * Include Bytes and Polygon data types tests * Polygons test * Merging other tests * Fixing some postgres tests
2019-06-19 17:19:47 -07:00
expect(() => parseObjectFields('some string')).toThrow(
jasmine.stringMatching('is not a valid Object')
);
expect(() => parseObjectFields(123)).toThrow(jasmine.stringMatching('is not a valid Object'));
GraphQL Support (#5674) * GraphQL boilerplate * Create GraphQL schema without using gql * Introducing loaders * Generic create mutation * create mutation is now working for any data type * Create mutation for each parse class - partial * Adding more data types to the class * Get parse class query * Generic get query * Generic delete mutation * Parse class delete mutation * Parse class find mutation * Generic update mutation * Parse class update mutation * Fixing initialization problems * Installing node-fetch again * Basic implementation for Pointer * Constructor tests * API tests boilerplate * _getGraphQLOptions * applyGraphQL tests * GraphQL API initial tests * applyPlayground tests * createSubscriptions tests * ParseGrapjQLSchema tests file * ParseGraphQLSchema tests * TypeValidationError * TypeValidationError * parseStringValue test * parseIntValue tests * parseBooleanValue tests * parseDateValue tests * parseValue tests * parseListValues tests * parseObjectFields tests * Default types tests * Get tests * First permission test at generic Get operation * Fixing prepare data * ApolloClient does not work well with different queries runnning in paralell with different headers * ApolloClient does not work well with different queries runnning in paralell with different headers * User 3 tests * User 3 tests * Get level permission tests * Get User specific tests * Get now support keys argument * Get now supports include argument * Get now supports read preferences * Adding tests for read preference enum type * Find basic test * Find permissions test * Find where argument test * Order, skip and limit tests * Error handler * Find now supports count * Test for FindResult type * Improving find count * Find max limit test * Find now supports keys, include and includeAll * Find now supports read preferences * Basic Create test * Generic create mutation tests * Basic update test * UpdateResult object type test * Update level permissions tests * Error handler for default mutations * Delete mutation basic test * Delete mutation level permission tests * Test for string * String test * Date test * Pointer test * Relation tests * Changing objects mutations location * Changing objects queries location * Create file mutation * Test for file fields * Test for null values * Changing parse classes operations location * Objects mutations refactoring * Class specific create object mutation now working * Update class specific mutation now working * Specific class delete mutation now working * Get class specific mutation now working * Find class specific query now working without where and sort * Find query for custom classes working with where partially * Almost all data types working for specfic class find where * Now only missing relation, geopoint, file and ACL * Additional tests with Parse classes queries and mutations * Now only missing relation, geopoint, file and ACL * Files * Fiels are now working * Excluding missing order test temporarly * Refactoring dates * Refactoring files * Default types review * Refeactoring object queries * Refactoring class scalar type * Refactoring class types * Geo queries are now working * Fixing centerSphere * Allow sort on class specific queries * Supporting bytes * ACL constraint * Temporarly removing xit tests * Fixing some tests because of schema cache * Removing session token from users * Parse.User queries and mutations * Remove test using fit * Fixing include test that was failing because of schema cache * Fixing count test for postgres. Postgres does not count with where={} (legacy problem). We should solve it later * Fix null values test for postgres. It is evaluating null as undefined (legacy problem) and we should fix is later. * Fixing schema change test that was failing because of schema cache * Add GraphQL File type parseLiteral tests * Refeactoring users * Including sign up mutation * Fix failing test * Improve default GraphQL types tests coverage * Including some tests for data types * Including additional pointer test: * Fixing some tests * more data type tests * Include Bytes and Polygon data types tests * Polygons test * Merging other tests * Fixing some postgres tests
2019-06-19 17:19:47 -07:00
});
});
describe('Date', () => {
describe('parse literal', () => {
const { parseLiteral } = DATE;
it('should parse to date if string', () => {
const date = '2019-05-09T23:12:00.000Z';
expect(parseLiteral(createValue(Kind.STRING, date))).toEqual({
__type: 'Date',
iso: new Date(date),
});
});
it('should parse to date if object', () => {
const date = '2019-05-09T23:12:00.000Z';
expect(
parseLiteral(
createValue(Kind.OBJECT, undefined, undefined, [
createObjectField('__type', { value: 'Date' }),
createObjectField('iso', { value: date, kind: Kind.STRING }),
])
)
).toEqual({
__type: 'Date',
iso: new Date(date),
});
});
it('should fail if not an valid object or string', () => {
expect(() => parseLiteral({})).toThrow(jasmine.stringMatching('is not a valid Date'));
GraphQL Support (#5674) * GraphQL boilerplate * Create GraphQL schema without using gql * Introducing loaders * Generic create mutation * create mutation is now working for any data type * Create mutation for each parse class - partial * Adding more data types to the class * Get parse class query * Generic get query * Generic delete mutation * Parse class delete mutation * Parse class find mutation * Generic update mutation * Parse class update mutation * Fixing initialization problems * Installing node-fetch again * Basic implementation for Pointer * Constructor tests * API tests boilerplate * _getGraphQLOptions * applyGraphQL tests * GraphQL API initial tests * applyPlayground tests * createSubscriptions tests * ParseGrapjQLSchema tests file * ParseGraphQLSchema tests * TypeValidationError * TypeValidationError * parseStringValue test * parseIntValue tests * parseBooleanValue tests * parseDateValue tests * parseValue tests * parseListValues tests * parseObjectFields tests * Default types tests * Get tests * First permission test at generic Get operation * Fixing prepare data * ApolloClient does not work well with different queries runnning in paralell with different headers * ApolloClient does not work well with different queries runnning in paralell with different headers * User 3 tests * User 3 tests * Get level permission tests * Get User specific tests * Get now support keys argument * Get now supports include argument * Get now supports read preferences * Adding tests for read preference enum type * Find basic test * Find permissions test * Find where argument test * Order, skip and limit tests * Error handler * Find now supports count * Test for FindResult type * Improving find count * Find max limit test * Find now supports keys, include and includeAll * Find now supports read preferences * Basic Create test * Generic create mutation tests * Basic update test * UpdateResult object type test * Update level permissions tests * Error handler for default mutations * Delete mutation basic test * Delete mutation level permission tests * Test for string * String test * Date test * Pointer test * Relation tests * Changing objects mutations location * Changing objects queries location * Create file mutation * Test for file fields * Test for null values * Changing parse classes operations location * Objects mutations refactoring * Class specific create object mutation now working * Update class specific mutation now working * Specific class delete mutation now working * Get class specific mutation now working * Find class specific query now working without where and sort * Find query for custom classes working with where partially * Almost all data types working for specfic class find where * Now only missing relation, geopoint, file and ACL * Additional tests with Parse classes queries and mutations * Now only missing relation, geopoint, file and ACL * Files * Fiels are now working * Excluding missing order test temporarly * Refactoring dates * Refactoring files * Default types review * Refeactoring object queries * Refactoring class scalar type * Refactoring class types * Geo queries are now working * Fixing centerSphere * Allow sort on class specific queries * Supporting bytes * ACL constraint * Temporarly removing xit tests * Fixing some tests because of schema cache * Removing session token from users * Parse.User queries and mutations * Remove test using fit * Fixing include test that was failing because of schema cache * Fixing count test for postgres. Postgres does not count with where={} (legacy problem). We should solve it later * Fix null values test for postgres. It is evaluating null as undefined (legacy problem) and we should fix is later. * Fixing schema change test that was failing because of schema cache * Add GraphQL File type parseLiteral tests * Refeactoring users * Including sign up mutation * Fix failing test * Improve default GraphQL types tests coverage * Including some tests for data types * Including additional pointer test: * Fixing some tests * more data type tests * Include Bytes and Polygon data types tests * Polygons test * Merging other tests * Fixing some postgres tests
2019-06-19 17:19:47 -07:00
expect(() =>
parseLiteral(
createValue(Kind.OBJECT, undefined, undefined, [
createObjectField('__type', { value: 'Foo' }),
createObjectField('iso', { value: '2019-05-09T23:12:00.000Z' }),
])
)
).toThrow(jasmine.stringMatching('is not a valid Date'));
expect(() => parseLiteral([])).toThrow(jasmine.stringMatching('is not a valid Date'));
expect(() => parseLiteral(123)).toThrow(jasmine.stringMatching('is not a valid Date'));
GraphQL Support (#5674) * GraphQL boilerplate * Create GraphQL schema without using gql * Introducing loaders * Generic create mutation * create mutation is now working for any data type * Create mutation for each parse class - partial * Adding more data types to the class * Get parse class query * Generic get query * Generic delete mutation * Parse class delete mutation * Parse class find mutation * Generic update mutation * Parse class update mutation * Fixing initialization problems * Installing node-fetch again * Basic implementation for Pointer * Constructor tests * API tests boilerplate * _getGraphQLOptions * applyGraphQL tests * GraphQL API initial tests * applyPlayground tests * createSubscriptions tests * ParseGrapjQLSchema tests file * ParseGraphQLSchema tests * TypeValidationError * TypeValidationError * parseStringValue test * parseIntValue tests * parseBooleanValue tests * parseDateValue tests * parseValue tests * parseListValues tests * parseObjectFields tests * Default types tests * Get tests * First permission test at generic Get operation * Fixing prepare data * ApolloClient does not work well with different queries runnning in paralell with different headers * ApolloClient does not work well with different queries runnning in paralell with different headers * User 3 tests * User 3 tests * Get level permission tests * Get User specific tests * Get now support keys argument * Get now supports include argument * Get now supports read preferences * Adding tests for read preference enum type * Find basic test * Find permissions test * Find where argument test * Order, skip and limit tests * Error handler * Find now supports count * Test for FindResult type * Improving find count * Find max limit test * Find now supports keys, include and includeAll * Find now supports read preferences * Basic Create test * Generic create mutation tests * Basic update test * UpdateResult object type test * Update level permissions tests * Error handler for default mutations * Delete mutation basic test * Delete mutation level permission tests * Test for string * String test * Date test * Pointer test * Relation tests * Changing objects mutations location * Changing objects queries location * Create file mutation * Test for file fields * Test for null values * Changing parse classes operations location * Objects mutations refactoring * Class specific create object mutation now working * Update class specific mutation now working * Specific class delete mutation now working * Get class specific mutation now working * Find class specific query now working without where and sort * Find query for custom classes working with where partially * Almost all data types working for specfic class find where * Now only missing relation, geopoint, file and ACL * Additional tests with Parse classes queries and mutations * Now only missing relation, geopoint, file and ACL * Files * Fiels are now working * Excluding missing order test temporarly * Refactoring dates * Refactoring files * Default types review * Refeactoring object queries * Refactoring class scalar type * Refactoring class types * Geo queries are now working * Fixing centerSphere * Allow sort on class specific queries * Supporting bytes * ACL constraint * Temporarly removing xit tests * Fixing some tests because of schema cache * Removing session token from users * Parse.User queries and mutations * Remove test using fit * Fixing include test that was failing because of schema cache * Fixing count test for postgres. Postgres does not count with where={} (legacy problem). We should solve it later * Fix null values test for postgres. It is evaluating null as undefined (legacy problem) and we should fix is later. * Fixing schema change test that was failing because of schema cache * Add GraphQL File type parseLiteral tests * Refeactoring users * Including sign up mutation * Fix failing test * Improve default GraphQL types tests coverage * Including some tests for data types * Including additional pointer test: * Fixing some tests * more data type tests * Include Bytes and Polygon data types tests * Polygons test * Merging other tests * Fixing some postgres tests
2019-06-19 17:19:47 -07:00
});
});
describe('parse value', () => {
const { parseValue } = DATE;
it('should parse string value', () => {
const date = '2019-05-09T23:12:00.000Z';
expect(parseValue(date)).toEqual({
__type: 'Date',
iso: new Date(date),
});
});
it('should parse object value', () => {
const input = {
__type: 'Date',
iso: new Date('2019-05-09T23:12:00.000Z'),
};
expect(parseValue(input)).toEqual(input);
});
it('should fail if not an valid object or string', () => {
expect(() => parseValue({})).toThrow(jasmine.stringMatching('is not a valid Date'));
GraphQL Support (#5674) * GraphQL boilerplate * Create GraphQL schema without using gql * Introducing loaders * Generic create mutation * create mutation is now working for any data type * Create mutation for each parse class - partial * Adding more data types to the class * Get parse class query * Generic get query * Generic delete mutation * Parse class delete mutation * Parse class find mutation * Generic update mutation * Parse class update mutation * Fixing initialization problems * Installing node-fetch again * Basic implementation for Pointer * Constructor tests * API tests boilerplate * _getGraphQLOptions * applyGraphQL tests * GraphQL API initial tests * applyPlayground tests * createSubscriptions tests * ParseGrapjQLSchema tests file * ParseGraphQLSchema tests * TypeValidationError * TypeValidationError * parseStringValue test * parseIntValue tests * parseBooleanValue tests * parseDateValue tests * parseValue tests * parseListValues tests * parseObjectFields tests * Default types tests * Get tests * First permission test at generic Get operation * Fixing prepare data * ApolloClient does not work well with different queries runnning in paralell with different headers * ApolloClient does not work well with different queries runnning in paralell with different headers * User 3 tests * User 3 tests * Get level permission tests * Get User specific tests * Get now support keys argument * Get now supports include argument * Get now supports read preferences * Adding tests for read preference enum type * Find basic test * Find permissions test * Find where argument test * Order, skip and limit tests * Error handler * Find now supports count * Test for FindResult type * Improving find count * Find max limit test * Find now supports keys, include and includeAll * Find now supports read preferences * Basic Create test * Generic create mutation tests * Basic update test * UpdateResult object type test * Update level permissions tests * Error handler for default mutations * Delete mutation basic test * Delete mutation level permission tests * Test for string * String test * Date test * Pointer test * Relation tests * Changing objects mutations location * Changing objects queries location * Create file mutation * Test for file fields * Test for null values * Changing parse classes operations location * Objects mutations refactoring * Class specific create object mutation now working * Update class specific mutation now working * Specific class delete mutation now working * Get class specific mutation now working * Find class specific query now working without where and sort * Find query for custom classes working with where partially * Almost all data types working for specfic class find where * Now only missing relation, geopoint, file and ACL * Additional tests with Parse classes queries and mutations * Now only missing relation, geopoint, file and ACL * Files * Fiels are now working * Excluding missing order test temporarly * Refactoring dates * Refactoring files * Default types review * Refeactoring object queries * Refactoring class scalar type * Refactoring class types * Geo queries are now working * Fixing centerSphere * Allow sort on class specific queries * Supporting bytes * ACL constraint * Temporarly removing xit tests * Fixing some tests because of schema cache * Removing session token from users * Parse.User queries and mutations * Remove test using fit * Fixing include test that was failing because of schema cache * Fixing count test for postgres. Postgres does not count with where={} (legacy problem). We should solve it later * Fix null values test for postgres. It is evaluating null as undefined (legacy problem) and we should fix is later. * Fixing schema change test that was failing because of schema cache * Add GraphQL File type parseLiteral tests * Refeactoring users * Including sign up mutation * Fix failing test * Improve default GraphQL types tests coverage * Including some tests for data types * Including additional pointer test: * Fixing some tests * more data type tests * Include Bytes and Polygon data types tests * Polygons test * Merging other tests * Fixing some postgres tests
2019-06-19 17:19:47 -07:00
expect(() =>
parseValue({
__type: 'Foo',
iso: '2019-05-09T23:12:00.000Z',
})
).toThrow(jasmine.stringMatching('is not a valid Date'));
expect(() =>
parseValue({
__type: 'Date',
iso: 'foo',
})
).toThrow(jasmine.stringMatching('is not a valid Date'));
expect(() => parseValue([])).toThrow(jasmine.stringMatching('is not a valid Date'));
expect(() => parseValue(123)).toThrow(jasmine.stringMatching('is not a valid Date'));
GraphQL Support (#5674) * GraphQL boilerplate * Create GraphQL schema without using gql * Introducing loaders * Generic create mutation * create mutation is now working for any data type * Create mutation for each parse class - partial * Adding more data types to the class * Get parse class query * Generic get query * Generic delete mutation * Parse class delete mutation * Parse class find mutation * Generic update mutation * Parse class update mutation * Fixing initialization problems * Installing node-fetch again * Basic implementation for Pointer * Constructor tests * API tests boilerplate * _getGraphQLOptions * applyGraphQL tests * GraphQL API initial tests * applyPlayground tests * createSubscriptions tests * ParseGrapjQLSchema tests file * ParseGraphQLSchema tests * TypeValidationError * TypeValidationError * parseStringValue test * parseIntValue tests * parseBooleanValue tests * parseDateValue tests * parseValue tests * parseListValues tests * parseObjectFields tests * Default types tests * Get tests * First permission test at generic Get operation * Fixing prepare data * ApolloClient does not work well with different queries runnning in paralell with different headers * ApolloClient does not work well with different queries runnning in paralell with different headers * User 3 tests * User 3 tests * Get level permission tests * Get User specific tests * Get now support keys argument * Get now supports include argument * Get now supports read preferences * Adding tests for read preference enum type * Find basic test * Find permissions test * Find where argument test * Order, skip and limit tests * Error handler * Find now supports count * Test for FindResult type * Improving find count * Find max limit test * Find now supports keys, include and includeAll * Find now supports read preferences * Basic Create test * Generic create mutation tests * Basic update test * UpdateResult object type test * Update level permissions tests * Error handler for default mutations * Delete mutation basic test * Delete mutation level permission tests * Test for string * String test * Date test * Pointer test * Relation tests * Changing objects mutations location * Changing objects queries location * Create file mutation * Test for file fields * Test for null values * Changing parse classes operations location * Objects mutations refactoring * Class specific create object mutation now working * Update class specific mutation now working * Specific class delete mutation now working * Get class specific mutation now working * Find class specific query now working without where and sort * Find query for custom classes working with where partially * Almost all data types working for specfic class find where * Now only missing relation, geopoint, file and ACL * Additional tests with Parse classes queries and mutations * Now only missing relation, geopoint, file and ACL * Files * Fiels are now working * Excluding missing order test temporarly * Refactoring dates * Refactoring files * Default types review * Refeactoring object queries * Refactoring class scalar type * Refactoring class types * Geo queries are now working * Fixing centerSphere * Allow sort on class specific queries * Supporting bytes * ACL constraint * Temporarly removing xit tests * Fixing some tests because of schema cache * Removing session token from users * Parse.User queries and mutations * Remove test using fit * Fixing include test that was failing because of schema cache * Fixing count test for postgres. Postgres does not count with where={} (legacy problem). We should solve it later * Fix null values test for postgres. It is evaluating null as undefined (legacy problem) and we should fix is later. * Fixing schema change test that was failing because of schema cache * Add GraphQL File type parseLiteral tests * Refeactoring users * Including sign up mutation * Fix failing test * Improve default GraphQL types tests coverage * Including some tests for data types * Including additional pointer test: * Fixing some tests * more data type tests * Include Bytes and Polygon data types tests * Polygons test * Merging other tests * Fixing some postgres tests
2019-06-19 17:19:47 -07:00
});
});
describe('serialize date type', () => {
const { serialize } = DATE;
it('should do nothing if string', () => {
const str = '2019-05-09T23:12:00.000Z';
expect(serialize(str)).toBe(str);
});
it('should serialize date', () => {
const date = new Date();
expect(serialize(date)).toBe(date.toISOString());
GraphQL Support (#5674) * GraphQL boilerplate * Create GraphQL schema without using gql * Introducing loaders * Generic create mutation * create mutation is now working for any data type * Create mutation for each parse class - partial * Adding more data types to the class * Get parse class query * Generic get query * Generic delete mutation * Parse class delete mutation * Parse class find mutation * Generic update mutation * Parse class update mutation * Fixing initialization problems * Installing node-fetch again * Basic implementation for Pointer * Constructor tests * API tests boilerplate * _getGraphQLOptions * applyGraphQL tests * GraphQL API initial tests * applyPlayground tests * createSubscriptions tests * ParseGrapjQLSchema tests file * ParseGraphQLSchema tests * TypeValidationError * TypeValidationError * parseStringValue test * parseIntValue tests * parseBooleanValue tests * parseDateValue tests * parseValue tests * parseListValues tests * parseObjectFields tests * Default types tests * Get tests * First permission test at generic Get operation * Fixing prepare data * ApolloClient does not work well with different queries runnning in paralell with different headers * ApolloClient does not work well with different queries runnning in paralell with different headers * User 3 tests * User 3 tests * Get level permission tests * Get User specific tests * Get now support keys argument * Get now supports include argument * Get now supports read preferences * Adding tests for read preference enum type * Find basic test * Find permissions test * Find where argument test * Order, skip and limit tests * Error handler * Find now supports count * Test for FindResult type * Improving find count * Find max limit test * Find now supports keys, include and includeAll * Find now supports read preferences * Basic Create test * Generic create mutation tests * Basic update test * UpdateResult object type test * Update level permissions tests * Error handler for default mutations * Delete mutation basic test * Delete mutation level permission tests * Test for string * String test * Date test * Pointer test * Relation tests * Changing objects mutations location * Changing objects queries location * Create file mutation * Test for file fields * Test for null values * Changing parse classes operations location * Objects mutations refactoring * Class specific create object mutation now working * Update class specific mutation now working * Specific class delete mutation now working * Get class specific mutation now working * Find class specific query now working without where and sort * Find query for custom classes working with where partially * Almost all data types working for specfic class find where * Now only missing relation, geopoint, file and ACL * Additional tests with Parse classes queries and mutations * Now only missing relation, geopoint, file and ACL * Files * Fiels are now working * Excluding missing order test temporarly * Refactoring dates * Refactoring files * Default types review * Refeactoring object queries * Refactoring class scalar type * Refactoring class types * Geo queries are now working * Fixing centerSphere * Allow sort on class specific queries * Supporting bytes * ACL constraint * Temporarly removing xit tests * Fixing some tests because of schema cache * Removing session token from users * Parse.User queries and mutations * Remove test using fit * Fixing include test that was failing because of schema cache * Fixing count test for postgres. Postgres does not count with where={} (legacy problem). We should solve it later * Fix null values test for postgres. It is evaluating null as undefined (legacy problem) and we should fix is later. * Fixing schema change test that was failing because of schema cache * Add GraphQL File type parseLiteral tests * Refeactoring users * Including sign up mutation * Fix failing test * Improve default GraphQL types tests coverage * Including some tests for data types * Including additional pointer test: * Fixing some tests * more data type tests * Include Bytes and Polygon data types tests * Polygons test * Merging other tests * Fixing some postgres tests
2019-06-19 17:19:47 -07:00
});
it('should return iso value if object', () => {
const iso = '2019-05-09T23:12:00.000Z';
const date = {
__type: 'Date',
iso,
};
expect(serialize(date)).toEqual(iso);
});
it('should fail if not an valid object or string', () => {
expect(() => serialize({})).toThrow(jasmine.stringMatching('is not a valid Date'));
GraphQL Support (#5674) * GraphQL boilerplate * Create GraphQL schema without using gql * Introducing loaders * Generic create mutation * create mutation is now working for any data type * Create mutation for each parse class - partial * Adding more data types to the class * Get parse class query * Generic get query * Generic delete mutation * Parse class delete mutation * Parse class find mutation * Generic update mutation * Parse class update mutation * Fixing initialization problems * Installing node-fetch again * Basic implementation for Pointer * Constructor tests * API tests boilerplate * _getGraphQLOptions * applyGraphQL tests * GraphQL API initial tests * applyPlayground tests * createSubscriptions tests * ParseGrapjQLSchema tests file * ParseGraphQLSchema tests * TypeValidationError * TypeValidationError * parseStringValue test * parseIntValue tests * parseBooleanValue tests * parseDateValue tests * parseValue tests * parseListValues tests * parseObjectFields tests * Default types tests * Get tests * First permission test at generic Get operation * Fixing prepare data * ApolloClient does not work well with different queries runnning in paralell with different headers * ApolloClient does not work well with different queries runnning in paralell with different headers * User 3 tests * User 3 tests * Get level permission tests * Get User specific tests * Get now support keys argument * Get now supports include argument * Get now supports read preferences * Adding tests for read preference enum type * Find basic test * Find permissions test * Find where argument test * Order, skip and limit tests * Error handler * Find now supports count * Test for FindResult type * Improving find count * Find max limit test * Find now supports keys, include and includeAll * Find now supports read preferences * Basic Create test * Generic create mutation tests * Basic update test * UpdateResult object type test * Update level permissions tests * Error handler for default mutations * Delete mutation basic test * Delete mutation level permission tests * Test for string * String test * Date test * Pointer test * Relation tests * Changing objects mutations location * Changing objects queries location * Create file mutation * Test for file fields * Test for null values * Changing parse classes operations location * Objects mutations refactoring * Class specific create object mutation now working * Update class specific mutation now working * Specific class delete mutation now working * Get class specific mutation now working * Find class specific query now working without where and sort * Find query for custom classes working with where partially * Almost all data types working for specfic class find where * Now only missing relation, geopoint, file and ACL * Additional tests with Parse classes queries and mutations * Now only missing relation, geopoint, file and ACL * Files * Fiels are now working * Excluding missing order test temporarly * Refactoring dates * Refactoring files * Default types review * Refeactoring object queries * Refactoring class scalar type * Refactoring class types * Geo queries are now working * Fixing centerSphere * Allow sort on class specific queries * Supporting bytes * ACL constraint * Temporarly removing xit tests * Fixing some tests because of schema cache * Removing session token from users * Parse.User queries and mutations * Remove test using fit * Fixing include test that was failing because of schema cache * Fixing count test for postgres. Postgres does not count with where={} (legacy problem). We should solve it later * Fix null values test for postgres. It is evaluating null as undefined (legacy problem) and we should fix is later. * Fixing schema change test that was failing because of schema cache * Add GraphQL File type parseLiteral tests * Refeactoring users * Including sign up mutation * Fix failing test * Improve default GraphQL types tests coverage * Including some tests for data types * Including additional pointer test: * Fixing some tests * more data type tests * Include Bytes and Polygon data types tests * Polygons test * Merging other tests * Fixing some postgres tests
2019-06-19 17:19:47 -07:00
expect(() =>
serialize({
__type: 'Foo',
iso: '2019-05-09T23:12:00.000Z',
})
).toThrow(jasmine.stringMatching('is not a valid Date'));
expect(() => serialize([])).toThrow(jasmine.stringMatching('is not a valid Date'));
expect(() => serialize(123)).toThrow(jasmine.stringMatching('is not a valid Date'));
GraphQL Support (#5674) * GraphQL boilerplate * Create GraphQL schema without using gql * Introducing loaders * Generic create mutation * create mutation is now working for any data type * Create mutation for each parse class - partial * Adding more data types to the class * Get parse class query * Generic get query * Generic delete mutation * Parse class delete mutation * Parse class find mutation * Generic update mutation * Parse class update mutation * Fixing initialization problems * Installing node-fetch again * Basic implementation for Pointer * Constructor tests * API tests boilerplate * _getGraphQLOptions * applyGraphQL tests * GraphQL API initial tests * applyPlayground tests * createSubscriptions tests * ParseGrapjQLSchema tests file * ParseGraphQLSchema tests * TypeValidationError * TypeValidationError * parseStringValue test * parseIntValue tests * parseBooleanValue tests * parseDateValue tests * parseValue tests * parseListValues tests * parseObjectFields tests * Default types tests * Get tests * First permission test at generic Get operation * Fixing prepare data * ApolloClient does not work well with different queries runnning in paralell with different headers * ApolloClient does not work well with different queries runnning in paralell with different headers * User 3 tests * User 3 tests * Get level permission tests * Get User specific tests * Get now support keys argument * Get now supports include argument * Get now supports read preferences * Adding tests for read preference enum type * Find basic test * Find permissions test * Find where argument test * Order, skip and limit tests * Error handler * Find now supports count * Test for FindResult type * Improving find count * Find max limit test * Find now supports keys, include and includeAll * Find now supports read preferences * Basic Create test * Generic create mutation tests * Basic update test * UpdateResult object type test * Update level permissions tests * Error handler for default mutations * Delete mutation basic test * Delete mutation level permission tests * Test for string * String test * Date test * Pointer test * Relation tests * Changing objects mutations location * Changing objects queries location * Create file mutation * Test for file fields * Test for null values * Changing parse classes operations location * Objects mutations refactoring * Class specific create object mutation now working * Update class specific mutation now working * Specific class delete mutation now working * Get class specific mutation now working * Find class specific query now working without where and sort * Find query for custom classes working with where partially * Almost all data types working for specfic class find where * Now only missing relation, geopoint, file and ACL * Additional tests with Parse classes queries and mutations * Now only missing relation, geopoint, file and ACL * Files * Fiels are now working * Excluding missing order test temporarly * Refactoring dates * Refactoring files * Default types review * Refeactoring object queries * Refactoring class scalar type * Refactoring class types * Geo queries are now working * Fixing centerSphere * Allow sort on class specific queries * Supporting bytes * ACL constraint * Temporarly removing xit tests * Fixing some tests because of schema cache * Removing session token from users * Parse.User queries and mutations * Remove test using fit * Fixing include test that was failing because of schema cache * Fixing count test for postgres. Postgres does not count with where={} (legacy problem). We should solve it later * Fix null values test for postgres. It is evaluating null as undefined (legacy problem) and we should fix is later. * Fixing schema change test that was failing because of schema cache * Add GraphQL File type parseLiteral tests * Refeactoring users * Including sign up mutation * Fix failing test * Improve default GraphQL types tests coverage * Including some tests for data types * Including additional pointer test: * Fixing some tests * more data type tests * Include Bytes and Polygon data types tests * Polygons test * Merging other tests * Fixing some postgres tests
2019-06-19 17:19:47 -07:00
});
});
});
describe('Bytes', () => {
describe('parse literal', () => {
const { parseLiteral } = BYTES;
it('should parse to bytes if string', () => {
expect(parseLiteral(createValue(Kind.STRING, 'bytesContent'))).toEqual({
__type: 'Bytes',
base64: 'bytesContent',
});
});
it('should parse to bytes if object', () => {
expect(
parseLiteral(
createValue(Kind.OBJECT, undefined, undefined, [
createObjectField('__type', { value: 'Bytes' }),
createObjectField('base64', { value: 'bytesContent' }),
])
)
).toEqual({
__type: 'Bytes',
base64: 'bytesContent',
});
});
it('should fail if not an valid object or string', () => {
expect(() => parseLiteral({})).toThrow(jasmine.stringMatching('is not a valid Bytes'));
GraphQL Support (#5674) * GraphQL boilerplate * Create GraphQL schema without using gql * Introducing loaders * Generic create mutation * create mutation is now working for any data type * Create mutation for each parse class - partial * Adding more data types to the class * Get parse class query * Generic get query * Generic delete mutation * Parse class delete mutation * Parse class find mutation * Generic update mutation * Parse class update mutation * Fixing initialization problems * Installing node-fetch again * Basic implementation for Pointer * Constructor tests * API tests boilerplate * _getGraphQLOptions * applyGraphQL tests * GraphQL API initial tests * applyPlayground tests * createSubscriptions tests * ParseGrapjQLSchema tests file * ParseGraphQLSchema tests * TypeValidationError * TypeValidationError * parseStringValue test * parseIntValue tests * parseBooleanValue tests * parseDateValue tests * parseValue tests * parseListValues tests * parseObjectFields tests * Default types tests * Get tests * First permission test at generic Get operation * Fixing prepare data * ApolloClient does not work well with different queries runnning in paralell with different headers * ApolloClient does not work well with different queries runnning in paralell with different headers * User 3 tests * User 3 tests * Get level permission tests * Get User specific tests * Get now support keys argument * Get now supports include argument * Get now supports read preferences * Adding tests for read preference enum type * Find basic test * Find permissions test * Find where argument test * Order, skip and limit tests * Error handler * Find now supports count * Test for FindResult type * Improving find count * Find max limit test * Find now supports keys, include and includeAll * Find now supports read preferences * Basic Create test * Generic create mutation tests * Basic update test * UpdateResult object type test * Update level permissions tests * Error handler for default mutations * Delete mutation basic test * Delete mutation level permission tests * Test for string * String test * Date test * Pointer test * Relation tests * Changing objects mutations location * Changing objects queries location * Create file mutation * Test for file fields * Test for null values * Changing parse classes operations location * Objects mutations refactoring * Class specific create object mutation now working * Update class specific mutation now working * Specific class delete mutation now working * Get class specific mutation now working * Find class specific query now working without where and sort * Find query for custom classes working with where partially * Almost all data types working for specfic class find where * Now only missing relation, geopoint, file and ACL * Additional tests with Parse classes queries and mutations * Now only missing relation, geopoint, file and ACL * Files * Fiels are now working * Excluding missing order test temporarly * Refactoring dates * Refactoring files * Default types review * Refeactoring object queries * Refactoring class scalar type * Refactoring class types * Geo queries are now working * Fixing centerSphere * Allow sort on class specific queries * Supporting bytes * ACL constraint * Temporarly removing xit tests * Fixing some tests because of schema cache * Removing session token from users * Parse.User queries and mutations * Remove test using fit * Fixing include test that was failing because of schema cache * Fixing count test for postgres. Postgres does not count with where={} (legacy problem). We should solve it later * Fix null values test for postgres. It is evaluating null as undefined (legacy problem) and we should fix is later. * Fixing schema change test that was failing because of schema cache * Add GraphQL File type parseLiteral tests * Refeactoring users * Including sign up mutation * Fix failing test * Improve default GraphQL types tests coverage * Including some tests for data types * Including additional pointer test: * Fixing some tests * more data type tests * Include Bytes and Polygon data types tests * Polygons test * Merging other tests * Fixing some postgres tests
2019-06-19 17:19:47 -07:00
expect(() =>
parseLiteral(
createValue(Kind.OBJECT, undefined, undefined, [
createObjectField('__type', { value: 'Foo' }),
createObjectField('base64', { value: 'bytesContent' }),
])
)
).toThrow(jasmine.stringMatching('is not a valid Bytes'));
expect(() => parseLiteral([])).toThrow(jasmine.stringMatching('is not a valid Bytes'));
expect(() => parseLiteral(123)).toThrow(jasmine.stringMatching('is not a valid Bytes'));
GraphQL Support (#5674) * GraphQL boilerplate * Create GraphQL schema without using gql * Introducing loaders * Generic create mutation * create mutation is now working for any data type * Create mutation for each parse class - partial * Adding more data types to the class * Get parse class query * Generic get query * Generic delete mutation * Parse class delete mutation * Parse class find mutation * Generic update mutation * Parse class update mutation * Fixing initialization problems * Installing node-fetch again * Basic implementation for Pointer * Constructor tests * API tests boilerplate * _getGraphQLOptions * applyGraphQL tests * GraphQL API initial tests * applyPlayground tests * createSubscriptions tests * ParseGrapjQLSchema tests file * ParseGraphQLSchema tests * TypeValidationError * TypeValidationError * parseStringValue test * parseIntValue tests * parseBooleanValue tests * parseDateValue tests * parseValue tests * parseListValues tests * parseObjectFields tests * Default types tests * Get tests * First permission test at generic Get operation * Fixing prepare data * ApolloClient does not work well with different queries runnning in paralell with different headers * ApolloClient does not work well with different queries runnning in paralell with different headers * User 3 tests * User 3 tests * Get level permission tests * Get User specific tests * Get now support keys argument * Get now supports include argument * Get now supports read preferences * Adding tests for read preference enum type * Find basic test * Find permissions test * Find where argument test * Order, skip and limit tests * Error handler * Find now supports count * Test for FindResult type * Improving find count * Find max limit test * Find now supports keys, include and includeAll * Find now supports read preferences * Basic Create test * Generic create mutation tests * Basic update test * UpdateResult object type test * Update level permissions tests * Error handler for default mutations * Delete mutation basic test * Delete mutation level permission tests * Test for string * String test * Date test * Pointer test * Relation tests * Changing objects mutations location * Changing objects queries location * Create file mutation * Test for file fields * Test for null values * Changing parse classes operations location * Objects mutations refactoring * Class specific create object mutation now working * Update class specific mutation now working * Specific class delete mutation now working * Get class specific mutation now working * Find class specific query now working without where and sort * Find query for custom classes working with where partially * Almost all data types working for specfic class find where * Now only missing relation, geopoint, file and ACL * Additional tests with Parse classes queries and mutations * Now only missing relation, geopoint, file and ACL * Files * Fiels are now working * Excluding missing order test temporarly * Refactoring dates * Refactoring files * Default types review * Refeactoring object queries * Refactoring class scalar type * Refactoring class types * Geo queries are now working * Fixing centerSphere * Allow sort on class specific queries * Supporting bytes * ACL constraint * Temporarly removing xit tests * Fixing some tests because of schema cache * Removing session token from users * Parse.User queries and mutations * Remove test using fit * Fixing include test that was failing because of schema cache * Fixing count test for postgres. Postgres does not count with where={} (legacy problem). We should solve it later * Fix null values test for postgres. It is evaluating null as undefined (legacy problem) and we should fix is later. * Fixing schema change test that was failing because of schema cache * Add GraphQL File type parseLiteral tests * Refeactoring users * Including sign up mutation * Fix failing test * Improve default GraphQL types tests coverage * Including some tests for data types * Including additional pointer test: * Fixing some tests * more data type tests * Include Bytes and Polygon data types tests * Polygons test * Merging other tests * Fixing some postgres tests
2019-06-19 17:19:47 -07:00
});
});
describe('parse value', () => {
const { parseValue } = BYTES;
it('should parse string value', () => {
expect(parseValue('bytesContent')).toEqual({
__type: 'Bytes',
base64: 'bytesContent',
});
});
it('should parse object value', () => {
const input = {
__type: 'Bytes',
base64: 'bytesContent',
};
expect(parseValue(input)).toEqual(input);
});
it('should fail if not an valid object or string', () => {
expect(() => parseValue({})).toThrow(jasmine.stringMatching('is not a valid Bytes'));
GraphQL Support (#5674) * GraphQL boilerplate * Create GraphQL schema without using gql * Introducing loaders * Generic create mutation * create mutation is now working for any data type * Create mutation for each parse class - partial * Adding more data types to the class * Get parse class query * Generic get query * Generic delete mutation * Parse class delete mutation * Parse class find mutation * Generic update mutation * Parse class update mutation * Fixing initialization problems * Installing node-fetch again * Basic implementation for Pointer * Constructor tests * API tests boilerplate * _getGraphQLOptions * applyGraphQL tests * GraphQL API initial tests * applyPlayground tests * createSubscriptions tests * ParseGrapjQLSchema tests file * ParseGraphQLSchema tests * TypeValidationError * TypeValidationError * parseStringValue test * parseIntValue tests * parseBooleanValue tests * parseDateValue tests * parseValue tests * parseListValues tests * parseObjectFields tests * Default types tests * Get tests * First permission test at generic Get operation * Fixing prepare data * ApolloClient does not work well with different queries runnning in paralell with different headers * ApolloClient does not work well with different queries runnning in paralell with different headers * User 3 tests * User 3 tests * Get level permission tests * Get User specific tests * Get now support keys argument * Get now supports include argument * Get now supports read preferences * Adding tests for read preference enum type * Find basic test * Find permissions test * Find where argument test * Order, skip and limit tests * Error handler * Find now supports count * Test for FindResult type * Improving find count * Find max limit test * Find now supports keys, include and includeAll * Find now supports read preferences * Basic Create test * Generic create mutation tests * Basic update test * UpdateResult object type test * Update level permissions tests * Error handler for default mutations * Delete mutation basic test * Delete mutation level permission tests * Test for string * String test * Date test * Pointer test * Relation tests * Changing objects mutations location * Changing objects queries location * Create file mutation * Test for file fields * Test for null values * Changing parse classes operations location * Objects mutations refactoring * Class specific create object mutation now working * Update class specific mutation now working * Specific class delete mutation now working * Get class specific mutation now working * Find class specific query now working without where and sort * Find query for custom classes working with where partially * Almost all data types working for specfic class find where * Now only missing relation, geopoint, file and ACL * Additional tests with Parse classes queries and mutations * Now only missing relation, geopoint, file and ACL * Files * Fiels are now working * Excluding missing order test temporarly * Refactoring dates * Refactoring files * Default types review * Refeactoring object queries * Refactoring class scalar type * Refactoring class types * Geo queries are now working * Fixing centerSphere * Allow sort on class specific queries * Supporting bytes * ACL constraint * Temporarly removing xit tests * Fixing some tests because of schema cache * Removing session token from users * Parse.User queries and mutations * Remove test using fit * Fixing include test that was failing because of schema cache * Fixing count test for postgres. Postgres does not count with where={} (legacy problem). We should solve it later * Fix null values test for postgres. It is evaluating null as undefined (legacy problem) and we should fix is later. * Fixing schema change test that was failing because of schema cache * Add GraphQL File type parseLiteral tests * Refeactoring users * Including sign up mutation * Fix failing test * Improve default GraphQL types tests coverage * Including some tests for data types * Including additional pointer test: * Fixing some tests * more data type tests * Include Bytes and Polygon data types tests * Polygons test * Merging other tests * Fixing some postgres tests
2019-06-19 17:19:47 -07:00
expect(() =>
parseValue({
__type: 'Foo',
base64: 'bytesContent',
})
).toThrow(jasmine.stringMatching('is not a valid Bytes'));
expect(() => parseValue([])).toThrow(jasmine.stringMatching('is not a valid Bytes'));
expect(() => parseValue(123)).toThrow(jasmine.stringMatching('is not a valid Bytes'));
GraphQL Support (#5674) * GraphQL boilerplate * Create GraphQL schema without using gql * Introducing loaders * Generic create mutation * create mutation is now working for any data type * Create mutation for each parse class - partial * Adding more data types to the class * Get parse class query * Generic get query * Generic delete mutation * Parse class delete mutation * Parse class find mutation * Generic update mutation * Parse class update mutation * Fixing initialization problems * Installing node-fetch again * Basic implementation for Pointer * Constructor tests * API tests boilerplate * _getGraphQLOptions * applyGraphQL tests * GraphQL API initial tests * applyPlayground tests * createSubscriptions tests * ParseGrapjQLSchema tests file * ParseGraphQLSchema tests * TypeValidationError * TypeValidationError * parseStringValue test * parseIntValue tests * parseBooleanValue tests * parseDateValue tests * parseValue tests * parseListValues tests * parseObjectFields tests * Default types tests * Get tests * First permission test at generic Get operation * Fixing prepare data * ApolloClient does not work well with different queries runnning in paralell with different headers * ApolloClient does not work well with different queries runnning in paralell with different headers * User 3 tests * User 3 tests * Get level permission tests * Get User specific tests * Get now support keys argument * Get now supports include argument * Get now supports read preferences * Adding tests for read preference enum type * Find basic test * Find permissions test * Find where argument test * Order, skip and limit tests * Error handler * Find now supports count * Test for FindResult type * Improving find count * Find max limit test * Find now supports keys, include and includeAll * Find now supports read preferences * Basic Create test * Generic create mutation tests * Basic update test * UpdateResult object type test * Update level permissions tests * Error handler for default mutations * Delete mutation basic test * Delete mutation level permission tests * Test for string * String test * Date test * Pointer test * Relation tests * Changing objects mutations location * Changing objects queries location * Create file mutation * Test for file fields * Test for null values * Changing parse classes operations location * Objects mutations refactoring * Class specific create object mutation now working * Update class specific mutation now working * Specific class delete mutation now working * Get class specific mutation now working * Find class specific query now working without where and sort * Find query for custom classes working with where partially * Almost all data types working for specfic class find where * Now only missing relation, geopoint, file and ACL * Additional tests with Parse classes queries and mutations * Now only missing relation, geopoint, file and ACL * Files * Fiels are now working * Excluding missing order test temporarly * Refactoring dates * Refactoring files * Default types review * Refeactoring object queries * Refactoring class scalar type * Refactoring class types * Geo queries are now working * Fixing centerSphere * Allow sort on class specific queries * Supporting bytes * ACL constraint * Temporarly removing xit tests * Fixing some tests because of schema cache * Removing session token from users * Parse.User queries and mutations * Remove test using fit * Fixing include test that was failing because of schema cache * Fixing count test for postgres. Postgres does not count with where={} (legacy problem). We should solve it later * Fix null values test for postgres. It is evaluating null as undefined (legacy problem) and we should fix is later. * Fixing schema change test that was failing because of schema cache * Add GraphQL File type parseLiteral tests * Refeactoring users * Including sign up mutation * Fix failing test * Improve default GraphQL types tests coverage * Including some tests for data types * Including additional pointer test: * Fixing some tests * more data type tests * Include Bytes and Polygon data types tests * Polygons test * Merging other tests * Fixing some postgres tests
2019-06-19 17:19:47 -07:00
});
});
describe('serialize bytes type', () => {
const { serialize } = BYTES;
it('should do nothing if string', () => {
const str = 'foo';
expect(serialize(str)).toBe(str);
});
it('should return base64 value if object', () => {
const base64Content = 'bytesContent';
const bytes = {
__type: 'Bytes',
base64: base64Content,
};
expect(serialize(bytes)).toEqual(base64Content);
});
it('should fail if not an valid object or string', () => {
expect(() => serialize({})).toThrow(jasmine.stringMatching('is not a valid Bytes'));
GraphQL Support (#5674) * GraphQL boilerplate * Create GraphQL schema without using gql * Introducing loaders * Generic create mutation * create mutation is now working for any data type * Create mutation for each parse class - partial * Adding more data types to the class * Get parse class query * Generic get query * Generic delete mutation * Parse class delete mutation * Parse class find mutation * Generic update mutation * Parse class update mutation * Fixing initialization problems * Installing node-fetch again * Basic implementation for Pointer * Constructor tests * API tests boilerplate * _getGraphQLOptions * applyGraphQL tests * GraphQL API initial tests * applyPlayground tests * createSubscriptions tests * ParseGrapjQLSchema tests file * ParseGraphQLSchema tests * TypeValidationError * TypeValidationError * parseStringValue test * parseIntValue tests * parseBooleanValue tests * parseDateValue tests * parseValue tests * parseListValues tests * parseObjectFields tests * Default types tests * Get tests * First permission test at generic Get operation * Fixing prepare data * ApolloClient does not work well with different queries runnning in paralell with different headers * ApolloClient does not work well with different queries runnning in paralell with different headers * User 3 tests * User 3 tests * Get level permission tests * Get User specific tests * Get now support keys argument * Get now supports include argument * Get now supports read preferences * Adding tests for read preference enum type * Find basic test * Find permissions test * Find where argument test * Order, skip and limit tests * Error handler * Find now supports count * Test for FindResult type * Improving find count * Find max limit test * Find now supports keys, include and includeAll * Find now supports read preferences * Basic Create test * Generic create mutation tests * Basic update test * UpdateResult object type test * Update level permissions tests * Error handler for default mutations * Delete mutation basic test * Delete mutation level permission tests * Test for string * String test * Date test * Pointer test * Relation tests * Changing objects mutations location * Changing objects queries location * Create file mutation * Test for file fields * Test for null values * Changing parse classes operations location * Objects mutations refactoring * Class specific create object mutation now working * Update class specific mutation now working * Specific class delete mutation now working * Get class specific mutation now working * Find class specific query now working without where and sort * Find query for custom classes working with where partially * Almost all data types working for specfic class find where * Now only missing relation, geopoint, file and ACL * Additional tests with Parse classes queries and mutations * Now only missing relation, geopoint, file and ACL * Files * Fiels are now working * Excluding missing order test temporarly * Refactoring dates * Refactoring files * Default types review * Refeactoring object queries * Refactoring class scalar type * Refactoring class types * Geo queries are now working * Fixing centerSphere * Allow sort on class specific queries * Supporting bytes * ACL constraint * Temporarly removing xit tests * Fixing some tests because of schema cache * Removing session token from users * Parse.User queries and mutations * Remove test using fit * Fixing include test that was failing because of schema cache * Fixing count test for postgres. Postgres does not count with where={} (legacy problem). We should solve it later * Fix null values test for postgres. It is evaluating null as undefined (legacy problem) and we should fix is later. * Fixing schema change test that was failing because of schema cache * Add GraphQL File type parseLiteral tests * Refeactoring users * Including sign up mutation * Fix failing test * Improve default GraphQL types tests coverage * Including some tests for data types * Including additional pointer test: * Fixing some tests * more data type tests * Include Bytes and Polygon data types tests * Polygons test * Merging other tests * Fixing some postgres tests
2019-06-19 17:19:47 -07:00
expect(() =>
serialize({
__type: 'Foo',
base64: 'bytesContent',
})
).toThrow(jasmine.stringMatching('is not a valid Bytes'));
expect(() => serialize([])).toThrow(jasmine.stringMatching('is not a valid Bytes'));
expect(() => serialize(123)).toThrow(jasmine.stringMatching('is not a valid Bytes'));
GraphQL Support (#5674) * GraphQL boilerplate * Create GraphQL schema without using gql * Introducing loaders * Generic create mutation * create mutation is now working for any data type * Create mutation for each parse class - partial * Adding more data types to the class * Get parse class query * Generic get query * Generic delete mutation * Parse class delete mutation * Parse class find mutation * Generic update mutation * Parse class update mutation * Fixing initialization problems * Installing node-fetch again * Basic implementation for Pointer * Constructor tests * API tests boilerplate * _getGraphQLOptions * applyGraphQL tests * GraphQL API initial tests * applyPlayground tests * createSubscriptions tests * ParseGrapjQLSchema tests file * ParseGraphQLSchema tests * TypeValidationError * TypeValidationError * parseStringValue test * parseIntValue tests * parseBooleanValue tests * parseDateValue tests * parseValue tests * parseListValues tests * parseObjectFields tests * Default types tests * Get tests * First permission test at generic Get operation * Fixing prepare data * ApolloClient does not work well with different queries runnning in paralell with different headers * ApolloClient does not work well with different queries runnning in paralell with different headers * User 3 tests * User 3 tests * Get level permission tests * Get User specific tests * Get now support keys argument * Get now supports include argument * Get now supports read preferences * Adding tests for read preference enum type * Find basic test * Find permissions test * Find where argument test * Order, skip and limit tests * Error handler * Find now supports count * Test for FindResult type * Improving find count * Find max limit test * Find now supports keys, include and includeAll * Find now supports read preferences * Basic Create test * Generic create mutation tests * Basic update test * UpdateResult object type test * Update level permissions tests * Error handler for default mutations * Delete mutation basic test * Delete mutation level permission tests * Test for string * String test * Date test * Pointer test * Relation tests * Changing objects mutations location * Changing objects queries location * Create file mutation * Test for file fields * Test for null values * Changing parse classes operations location * Objects mutations refactoring * Class specific create object mutation now working * Update class specific mutation now working * Specific class delete mutation now working * Get class specific mutation now working * Find class specific query now working without where and sort * Find query for custom classes working with where partially * Almost all data types working for specfic class find where * Now only missing relation, geopoint, file and ACL * Additional tests with Parse classes queries and mutations * Now only missing relation, geopoint, file and ACL * Files * Fiels are now working * Excluding missing order test temporarly * Refactoring dates * Refactoring files * Default types review * Refeactoring object queries * Refactoring class scalar type * Refactoring class types * Geo queries are now working * Fixing centerSphere * Allow sort on class specific queries * Supporting bytes * ACL constraint * Temporarly removing xit tests * Fixing some tests because of schema cache * Removing session token from users * Parse.User queries and mutations * Remove test using fit * Fixing include test that was failing because of schema cache * Fixing count test for postgres. Postgres does not count with where={} (legacy problem). We should solve it later * Fix null values test for postgres. It is evaluating null as undefined (legacy problem) and we should fix is later. * Fixing schema change test that was failing because of schema cache * Add GraphQL File type parseLiteral tests * Refeactoring users * Including sign up mutation * Fix failing test * Improve default GraphQL types tests coverage * Including some tests for data types * Including additional pointer test: * Fixing some tests * more data type tests * Include Bytes and Polygon data types tests * Polygons test * Merging other tests * Fixing some postgres tests
2019-06-19 17:19:47 -07:00
});
});
});
describe('File', () => {
describe('parse literal', () => {
const { parseLiteral } = FILE;
it('should parse to file if string', () => {
expect(parseLiteral(createValue(Kind.STRING, 'parsefile'))).toEqual({
__type: 'File',
name: 'parsefile',
});
});
it('should parse to file if object', () => {
expect(
parseLiteral(
createValue(Kind.OBJECT, undefined, undefined, [
createObjectField('__type', { value: 'File' }),
createObjectField('name', { value: 'parsefile' }),
createObjectField('url', { value: 'myurl' }),
])
)
).toEqual({
__type: 'File',
name: 'parsefile',
url: 'myurl',
});
});
it('should fail if not an valid object or string', () => {
expect(() => parseLiteral({})).toThrow(jasmine.stringMatching('is not a valid File'));
GraphQL Support (#5674) * GraphQL boilerplate * Create GraphQL schema without using gql * Introducing loaders * Generic create mutation * create mutation is now working for any data type * Create mutation for each parse class - partial * Adding more data types to the class * Get parse class query * Generic get query * Generic delete mutation * Parse class delete mutation * Parse class find mutation * Generic update mutation * Parse class update mutation * Fixing initialization problems * Installing node-fetch again * Basic implementation for Pointer * Constructor tests * API tests boilerplate * _getGraphQLOptions * applyGraphQL tests * GraphQL API initial tests * applyPlayground tests * createSubscriptions tests * ParseGrapjQLSchema tests file * ParseGraphQLSchema tests * TypeValidationError * TypeValidationError * parseStringValue test * parseIntValue tests * parseBooleanValue tests * parseDateValue tests * parseValue tests * parseListValues tests * parseObjectFields tests * Default types tests * Get tests * First permission test at generic Get operation * Fixing prepare data * ApolloClient does not work well with different queries runnning in paralell with different headers * ApolloClient does not work well with different queries runnning in paralell with different headers * User 3 tests * User 3 tests * Get level permission tests * Get User specific tests * Get now support keys argument * Get now supports include argument * Get now supports read preferences * Adding tests for read preference enum type * Find basic test * Find permissions test * Find where argument test * Order, skip and limit tests * Error handler * Find now supports count * Test for FindResult type * Improving find count * Find max limit test * Find now supports keys, include and includeAll * Find now supports read preferences * Basic Create test * Generic create mutation tests * Basic update test * UpdateResult object type test * Update level permissions tests * Error handler for default mutations * Delete mutation basic test * Delete mutation level permission tests * Test for string * String test * Date test * Pointer test * Relation tests * Changing objects mutations location * Changing objects queries location * Create file mutation * Test for file fields * Test for null values * Changing parse classes operations location * Objects mutations refactoring * Class specific create object mutation now working * Update class specific mutation now working * Specific class delete mutation now working * Get class specific mutation now working * Find class specific query now working without where and sort * Find query for custom classes working with where partially * Almost all data types working for specfic class find where * Now only missing relation, geopoint, file and ACL * Additional tests with Parse classes queries and mutations * Now only missing relation, geopoint, file and ACL * Files * Fiels are now working * Excluding missing order test temporarly * Refactoring dates * Refactoring files * Default types review * Refeactoring object queries * Refactoring class scalar type * Refactoring class types * Geo queries are now working * Fixing centerSphere * Allow sort on class specific queries * Supporting bytes * ACL constraint * Temporarly removing xit tests * Fixing some tests because of schema cache * Removing session token from users * Parse.User queries and mutations * Remove test using fit * Fixing include test that was failing because of schema cache * Fixing count test for postgres. Postgres does not count with where={} (legacy problem). We should solve it later * Fix null values test for postgres. It is evaluating null as undefined (legacy problem) and we should fix is later. * Fixing schema change test that was failing because of schema cache * Add GraphQL File type parseLiteral tests * Refeactoring users * Including sign up mutation * Fix failing test * Improve default GraphQL types tests coverage * Including some tests for data types * Including additional pointer test: * Fixing some tests * more data type tests * Include Bytes and Polygon data types tests * Polygons test * Merging other tests * Fixing some postgres tests
2019-06-19 17:19:47 -07:00
expect(() =>
parseLiteral(
createValue(Kind.OBJECT, undefined, undefined, [
createObjectField('__type', { value: 'Foo' }),
createObjectField('name', { value: 'parsefile' }),
createObjectField('url', { value: 'myurl' }),
])
)
).toThrow(jasmine.stringMatching('is not a valid File'));
expect(() => parseLiteral([])).toThrow(jasmine.stringMatching('is not a valid File'));
expect(() => parseLiteral(123)).toThrow(jasmine.stringMatching('is not a valid File'));
GraphQL Support (#5674) * GraphQL boilerplate * Create GraphQL schema without using gql * Introducing loaders * Generic create mutation * create mutation is now working for any data type * Create mutation for each parse class - partial * Adding more data types to the class * Get parse class query * Generic get query * Generic delete mutation * Parse class delete mutation * Parse class find mutation * Generic update mutation * Parse class update mutation * Fixing initialization problems * Installing node-fetch again * Basic implementation for Pointer * Constructor tests * API tests boilerplate * _getGraphQLOptions * applyGraphQL tests * GraphQL API initial tests * applyPlayground tests * createSubscriptions tests * ParseGrapjQLSchema tests file * ParseGraphQLSchema tests * TypeValidationError * TypeValidationError * parseStringValue test * parseIntValue tests * parseBooleanValue tests * parseDateValue tests * parseValue tests * parseListValues tests * parseObjectFields tests * Default types tests * Get tests * First permission test at generic Get operation * Fixing prepare data * ApolloClient does not work well with different queries runnning in paralell with different headers * ApolloClient does not work well with different queries runnning in paralell with different headers * User 3 tests * User 3 tests * Get level permission tests * Get User specific tests * Get now support keys argument * Get now supports include argument * Get now supports read preferences * Adding tests for read preference enum type * Find basic test * Find permissions test * Find where argument test * Order, skip and limit tests * Error handler * Find now supports count * Test for FindResult type * Improving find count * Find max limit test * Find now supports keys, include and includeAll * Find now supports read preferences * Basic Create test * Generic create mutation tests * Basic update test * UpdateResult object type test * Update level permissions tests * Error handler for default mutations * Delete mutation basic test * Delete mutation level permission tests * Test for string * String test * Date test * Pointer test * Relation tests * Changing objects mutations location * Changing objects queries location * Create file mutation * Test for file fields * Test for null values * Changing parse classes operations location * Objects mutations refactoring * Class specific create object mutation now working * Update class specific mutation now working * Specific class delete mutation now working * Get class specific mutation now working * Find class specific query now working without where and sort * Find query for custom classes working with where partially * Almost all data types working for specfic class find where * Now only missing relation, geopoint, file and ACL * Additional tests with Parse classes queries and mutations * Now only missing relation, geopoint, file and ACL * Files * Fiels are now working * Excluding missing order test temporarly * Refactoring dates * Refactoring files * Default types review * Refeactoring object queries * Refactoring class scalar type * Refactoring class types * Geo queries are now working * Fixing centerSphere * Allow sort on class specific queries * Supporting bytes * ACL constraint * Temporarly removing xit tests * Fixing some tests because of schema cache * Removing session token from users * Parse.User queries and mutations * Remove test using fit * Fixing include test that was failing because of schema cache * Fixing count test for postgres. Postgres does not count with where={} (legacy problem). We should solve it later * Fix null values test for postgres. It is evaluating null as undefined (legacy problem) and we should fix is later. * Fixing schema change test that was failing because of schema cache * Add GraphQL File type parseLiteral tests * Refeactoring users * Including sign up mutation * Fix failing test * Improve default GraphQL types tests coverage * Including some tests for data types * Including additional pointer test: * Fixing some tests * more data type tests * Include Bytes and Polygon data types tests * Polygons test * Merging other tests * Fixing some postgres tests
2019-06-19 17:19:47 -07:00
});
});
describe('serialize file type', () => {
const { serialize } = FILE;
it('should do nothing if string', () => {
const str = 'foo';
expect(serialize(str)).toBe(str);
});
it('should return file name if object', () => {
const fileName = 'parsefile';
const file = {
__type: 'File',
name: fileName,
url: 'myurl',
};
expect(serialize(file)).toEqual(fileName);
});
it('should fail if not an valid object or string', () => {
expect(() => serialize({})).toThrow(jasmine.stringMatching('is not a valid File'));
GraphQL Support (#5674) * GraphQL boilerplate * Create GraphQL schema without using gql * Introducing loaders * Generic create mutation * create mutation is now working for any data type * Create mutation for each parse class - partial * Adding more data types to the class * Get parse class query * Generic get query * Generic delete mutation * Parse class delete mutation * Parse class find mutation * Generic update mutation * Parse class update mutation * Fixing initialization problems * Installing node-fetch again * Basic implementation for Pointer * Constructor tests * API tests boilerplate * _getGraphQLOptions * applyGraphQL tests * GraphQL API initial tests * applyPlayground tests * createSubscriptions tests * ParseGrapjQLSchema tests file * ParseGraphQLSchema tests * TypeValidationError * TypeValidationError * parseStringValue test * parseIntValue tests * parseBooleanValue tests * parseDateValue tests * parseValue tests * parseListValues tests * parseObjectFields tests * Default types tests * Get tests * First permission test at generic Get operation * Fixing prepare data * ApolloClient does not work well with different queries runnning in paralell with different headers * ApolloClient does not work well with different queries runnning in paralell with different headers * User 3 tests * User 3 tests * Get level permission tests * Get User specific tests * Get now support keys argument * Get now supports include argument * Get now supports read preferences * Adding tests for read preference enum type * Find basic test * Find permissions test * Find where argument test * Order, skip and limit tests * Error handler * Find now supports count * Test for FindResult type * Improving find count * Find max limit test * Find now supports keys, include and includeAll * Find now supports read preferences * Basic Create test * Generic create mutation tests * Basic update test * UpdateResult object type test * Update level permissions tests * Error handler for default mutations * Delete mutation basic test * Delete mutation level permission tests * Test for string * String test * Date test * Pointer test * Relation tests * Changing objects mutations location * Changing objects queries location * Create file mutation * Test for file fields * Test for null values * Changing parse classes operations location * Objects mutations refactoring * Class specific create object mutation now working * Update class specific mutation now working * Specific class delete mutation now working * Get class specific mutation now working * Find class specific query now working without where and sort * Find query for custom classes working with where partially * Almost all data types working for specfic class find where * Now only missing relation, geopoint, file and ACL * Additional tests with Parse classes queries and mutations * Now only missing relation, geopoint, file and ACL * Files * Fiels are now working * Excluding missing order test temporarly * Refactoring dates * Refactoring files * Default types review * Refeactoring object queries * Refactoring class scalar type * Refactoring class types * Geo queries are now working * Fixing centerSphere * Allow sort on class specific queries * Supporting bytes * ACL constraint * Temporarly removing xit tests * Fixing some tests because of schema cache * Removing session token from users * Parse.User queries and mutations * Remove test using fit * Fixing include test that was failing because of schema cache * Fixing count test for postgres. Postgres does not count with where={} (legacy problem). We should solve it later * Fix null values test for postgres. It is evaluating null as undefined (legacy problem) and we should fix is later. * Fixing schema change test that was failing because of schema cache * Add GraphQL File type parseLiteral tests * Refeactoring users * Including sign up mutation * Fix failing test * Improve default GraphQL types tests coverage * Including some tests for data types * Including additional pointer test: * Fixing some tests * more data type tests * Include Bytes and Polygon data types tests * Polygons test * Merging other tests * Fixing some postgres tests
2019-06-19 17:19:47 -07:00
expect(() =>
serialize({
__type: 'Foo',
name: 'parsefile',
url: 'myurl',
})
).toThrow(jasmine.stringMatching('is not a valid File'));
expect(() => serialize([])).toThrow(jasmine.stringMatching('is not a valid File'));
expect(() => serialize(123)).toThrow(jasmine.stringMatching('is not a valid File'));
GraphQL Support (#5674) * GraphQL boilerplate * Create GraphQL schema without using gql * Introducing loaders * Generic create mutation * create mutation is now working for any data type * Create mutation for each parse class - partial * Adding more data types to the class * Get parse class query * Generic get query * Generic delete mutation * Parse class delete mutation * Parse class find mutation * Generic update mutation * Parse class update mutation * Fixing initialization problems * Installing node-fetch again * Basic implementation for Pointer * Constructor tests * API tests boilerplate * _getGraphQLOptions * applyGraphQL tests * GraphQL API initial tests * applyPlayground tests * createSubscriptions tests * ParseGrapjQLSchema tests file * ParseGraphQLSchema tests * TypeValidationError * TypeValidationError * parseStringValue test * parseIntValue tests * parseBooleanValue tests * parseDateValue tests * parseValue tests * parseListValues tests * parseObjectFields tests * Default types tests * Get tests * First permission test at generic Get operation * Fixing prepare data * ApolloClient does not work well with different queries runnning in paralell with different headers * ApolloClient does not work well with different queries runnning in paralell with different headers * User 3 tests * User 3 tests * Get level permission tests * Get User specific tests * Get now support keys argument * Get now supports include argument * Get now supports read preferences * Adding tests for read preference enum type * Find basic test * Find permissions test * Find where argument test * Order, skip and limit tests * Error handler * Find now supports count * Test for FindResult type * Improving find count * Find max limit test * Find now supports keys, include and includeAll * Find now supports read preferences * Basic Create test * Generic create mutation tests * Basic update test * UpdateResult object type test * Update level permissions tests * Error handler for default mutations * Delete mutation basic test * Delete mutation level permission tests * Test for string * String test * Date test * Pointer test * Relation tests * Changing objects mutations location * Changing objects queries location * Create file mutation * Test for file fields * Test for null values * Changing parse classes operations location * Objects mutations refactoring * Class specific create object mutation now working * Update class specific mutation now working * Specific class delete mutation now working * Get class specific mutation now working * Find class specific query now working without where and sort * Find query for custom classes working with where partially * Almost all data types working for specfic class find where * Now only missing relation, geopoint, file and ACL * Additional tests with Parse classes queries and mutations * Now only missing relation, geopoint, file and ACL * Files * Fiels are now working * Excluding missing order test temporarly * Refactoring dates * Refactoring files * Default types review * Refeactoring object queries * Refactoring class scalar type * Refactoring class types * Geo queries are now working * Fixing centerSphere * Allow sort on class specific queries * Supporting bytes * ACL constraint * Temporarly removing xit tests * Fixing some tests because of schema cache * Removing session token from users * Parse.User queries and mutations * Remove test using fit * Fixing include test that was failing because of schema cache * Fixing count test for postgres. Postgres does not count with where={} (legacy problem). We should solve it later * Fix null values test for postgres. It is evaluating null as undefined (legacy problem) and we should fix is later. * Fixing schema change test that was failing because of schema cache * Add GraphQL File type parseLiteral tests * Refeactoring users * Including sign up mutation * Fix failing test * Improve default GraphQL types tests coverage * Including some tests for data types * Including additional pointer test: * Fixing some tests * more data type tests * Include Bytes and Polygon data types tests * Polygons test * Merging other tests * Fixing some postgres tests
2019-06-19 17:19:47 -07:00
});
});
});
});