Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
nousxiong
parse-server
提交
b5fc0d59
P
parse-server
项目概览
nousxiong
/
parse-server
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
parse-server
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
未验证
提交
b5fc0d59
编写于
10月 18, 2021
作者:
C
Corey
提交者:
GitHub
10月 18, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ci: enable more tests on Postgres adapter (#7641)
上级
80bf578c
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
113 addition
and
111 deletion
+113
-111
spec/ParseAPI.spec.js
spec/ParseAPI.spec.js
+1
-1
spec/ParseGraphQLServer.spec.js
spec/ParseGraphQLServer.spec.js
+92
-95
spec/ParseObject.spec.js
spec/ParseObject.spec.js
+2
-2
spec/ParsePolygon.spec.js
spec/ParsePolygon.spec.js
+12
-5
spec/ParseRelation.spec.js
spec/ParseRelation.spec.js
+3
-3
spec/SchemaPerformance.spec.js
spec/SchemaPerformance.spec.js
+3
-5
未找到文件。
spec/ParseAPI.spec.js
浏览文件 @
b5fc0d59
...
...
@@ -23,7 +23,7 @@ const headers = {
'
X-Parse-Installation-Id
'
:
'
yolo
'
,
};
describe
_only_db
(
'
mongo
'
)
(
'
miscellaneous
'
,
()
=>
{
describe
(
'
miscellaneous
'
,
()
=>
{
it
(
'
db contains document after successful save
'
,
async
()
=>
{
const
obj
=
new
Parse
.
Object
(
'
TestObject
'
);
obj
.
set
(
'
foo
'
,
'
bar
'
);
...
...
spec/ParseGraphQLServer.spec.js
浏览文件 @
b5fc0d59
...
...
@@ -4013,64 +4013,61 @@ describe('ParseGraphQLServer', () => {
expect
(
someClassSubObject
.
someClassField
).
toEqual
(
'
imSomeClassTwo
'
);
});
it_only_db
(
'
mongo
'
)(
'
should return many child objects in allow cyclic query
'
,
async
()
=>
{
const
obj1
=
new
Parse
.
Object
(
'
Employee
'
);
const
obj2
=
new
Parse
.
Object
(
'
Team
'
);
const
obj3
=
new
Parse
.
Object
(
'
Company
'
);
const
obj4
=
new
Parse
.
Object
(
'
Country
'
);
it
(
'
should return many child objects in allow cyclic query
'
,
async
()
=>
{
const
obj1
=
new
Parse
.
Object
(
'
Employee
'
);
const
obj2
=
new
Parse
.
Object
(
'
Team
'
);
const
obj3
=
new
Parse
.
Object
(
'
Company
'
);
const
obj4
=
new
Parse
.
Object
(
'
Country
'
);
obj1
.
set
(
'
name
'
,
'
imAnEmployee
'
);
await
obj1
.
save
();
obj1
.
set
(
'
name
'
,
'
imAnEmployee
'
);
await
obj1
.
save
();
obj2
.
set
(
'
name
'
,
'
imATeam
'
);
obj2
.
set
(
'
employees
'
,
[
obj1
]);
await
obj2
.
save
();
obj2
.
set
(
'
name
'
,
'
imATeam
'
);
obj2
.
set
(
'
employees
'
,
[
obj1
]);
await
obj2
.
save
();
obj3
.
set
(
'
name
'
,
'
imACompany
'
);
obj3
.
set
(
'
teams
'
,
[
obj2
]);
obj3
.
set
(
'
employees
'
,
[
obj1
]);
await
obj3
.
save
();
obj3
.
set
(
'
name
'
,
'
imACompany
'
);
obj3
.
set
(
'
teams
'
,
[
obj2
]);
obj3
.
set
(
'
employees
'
,
[
obj1
]);
await
obj3
.
save
();
obj4
.
set
(
'
name
'
,
'
imACountry
'
);
obj4
.
set
(
'
companies
'
,
[
obj3
]);
await
obj4
.
save
();
obj4
.
set
(
'
name
'
,
'
imACountry
'
);
obj4
.
set
(
'
companies
'
,
[
obj3
]);
await
obj4
.
save
();
obj1
.
set
(
'
country
'
,
obj4
);
await
obj1
.
save
();
obj1
.
set
(
'
country
'
,
obj4
);
await
obj1
.
save
();
await
parseGraphQLServer
.
parseGraphQLSchema
.
schemaCache
.
clear
();
await
parseGraphQLServer
.
parseGraphQLSchema
.
schemaCache
.
clear
();
const
result
=
(
await
apolloClient
.
query
({
query
:
gql
`
query DeepComplexGraphQLQuery($id: ID!) {
country(id: $id) {
objectId
name
companies {
... on Company {
objectId
name
employees {
... on Employee {
objectId
name
}
const
result
=
(
await
apolloClient
.
query
({
query
:
gql
`
query DeepComplexGraphQLQuery($id: ID!) {
country(id: $id) {
objectId
name
companies {
... on Company {
objectId
name
employees {
... on Employee {
objectId
name
}
teams {
... on Team {
objectId
name
employees {
... on Employee {
}
teams {
... on Team {
objectId
name
employees {
... on Employee {
objectId
name
country {
objectId
name
country {
objectId
name
}
}
}
}
...
...
@@ -4079,54 +4076,54 @@ describe('ParseGraphQLServer', () => {
}
}
}
`
,
variables
:
{
id
:
obj4
.
id
,
},
})
).
data
.
country
;
}
`
,
variables
:
{
id
:
obj4
.
id
,
},
})
).
data
.
country
;
const
expectedResult
=
{
objectId
:
obj4
.
id
,
name
:
'
imACountry
'
,
__typename
:
'
Country
'
,
companies
:
[
{
objectId
:
obj3
.
id
,
name
:
'
imACompany
'
,
__typename
:
'
Company
'
,
employees
:
[
{
objectId
:
obj1
.
id
,
name
:
'
imAnEmployee
'
,
__typename
:
'
Employee
'
,
},
],
teams
:
[
{
objectId
:
obj2
.
id
,
name
:
'
imATeam
'
,
__typename
:
'
Team
'
,
employees
:
[
{
objectId
:
obj1
.
id
,
name
:
'
imAnEmployee
'
,
__typename
:
'
Employee
'
,
country
:
{
objectId
:
obj4
.
id
,
name
:
'
imACountry
'
,
__typename
:
'
Country
'
,
},
const
expectedResult
=
{
objectId
:
obj4
.
id
,
name
:
'
imACountry
'
,
__typename
:
'
Country
'
,
companies
:
[
{
objectId
:
obj3
.
id
,
name
:
'
imACompany
'
,
__typename
:
'
Company
'
,
employees
:
[
{
objectId
:
obj1
.
id
,
name
:
'
imAnEmployee
'
,
__typename
:
'
Employee
'
,
},
],
teams
:
[
{
objectId
:
obj2
.
id
,
name
:
'
imATeam
'
,
__typename
:
'
Team
'
,
employees
:
[
{
objectId
:
obj1
.
id
,
name
:
'
imAnEmployee
'
,
__typename
:
'
Employee
'
,
country
:
{
objectId
:
obj4
.
id
,
name
:
'
imACountry
'
,
__typename
:
'
Country
'
,
},
]
,
}
,
]
,
}
,
]
,
};
expect
(
result
).
toEqual
(
expectedResult
)
;
}
);
}
,
]
,
}
,
]
,
}
,
],
}
;
expect
(
result
).
toEqual
(
expectedResult
);
}
);
it
(
'
should respect level permissions
'
,
async
()
=>
{
await
prepareData
();
...
...
@@ -8689,7 +8686,7 @@ describe('ParseGraphQLServer', () => {
expect
(
result2
.
companies
.
edges
[
0
].
node
.
objectId
).
toEqual
(
company1
.
id
);
});
it
_only_db
(
'
mongo
'
)
(
'
should support relational where query
'
,
async
()
=>
{
it
(
'
should support relational where query
'
,
async
()
=>
{
const
president
=
new
Parse
.
Object
(
'
President
'
);
president
.
set
(
'
name
'
,
'
James
'
);
await
president
.
save
();
...
...
spec/ParseObject.spec.js
浏览文件 @
b5fc0d59
...
...
@@ -223,7 +223,7 @@ describe('Parse.Object testing', () => {
});
});
it
_exclude_dbs
([
'
postgres
'
])
(
'
can set null
'
,
function
(
done
)
{
it
(
'
can set null
'
,
function
(
done
)
{
const
obj
=
new
Parse
.
Object
(
'
TestObject
'
);
obj
.
set
(
'
foo
'
,
null
);
obj
.
save
().
then
(
...
...
@@ -232,7 +232,7 @@ describe('Parse.Object testing', () => {
equal
(
obj
.
get
(
'
foo
'
),
null
);
});
on_db
(
'
postgres
'
,
()
=>
{
fail
(
'
should not succeed
'
);
equal
(
obj
.
get
(
'
foo
'
),
null
);
});
done
();
},
...
...
spec/ParsePolygon.spec.js
浏览文件 @
b5fc0d59
const
TestObject
=
Parse
.
Object
.
extend
(
'
TestObject
'
);
const
MongoStorageAdapter
=
require
(
'
../lib/Adapters/Storage/Mongo/MongoStorageAdapter
'
).
default
;
const
mongoURI
=
'
mongodb://localhost:27017/parseServerMongoAdapterTestDatabase
'
;
const
request
=
require
(
'
../lib/request
'
);
const
TestUtils
=
require
(
'
../lib/TestUtils
'
);
const
defaultHeaders
=
{
'
X-Parse-Application-Id
'
:
'
test
'
,
'
X-Parse-Rest-API-Key
'
:
'
rest
'
,
...
...
@@ -210,7 +209,7 @@ describe('Parse.Polygon testing', () => {
describe
(
'
with location
'
,
()
=>
{
if
(
process
.
env
.
PARSE_SERVER_TEST_DB
!==
'
postgres
'
)
{
beforeEach
(
()
=>
require
(
'
../lib/TestUtils
'
)
.
destroyAllDataPermanently
());
beforeEach
(
async
()
=>
await
TestUtils
.
destroyAllDataPermanently
());
}
it
(
'
polygonContain query
'
,
done
=>
{
...
...
@@ -425,7 +424,15 @@ describe('Parse.Polygon testing', () => {
});
describe_only_db
(
'
mongo
'
)(
'
Parse.Polygon testing
'
,
()
=>
{
beforeEach
(()
=>
require
(
'
../lib/TestUtils
'
).
destroyAllDataPermanently
());
const
Config
=
require
(
'
../lib/Config
'
);
let
config
;
beforeEach
(
async
()
=>
{
if
(
process
.
env
.
PARSE_SERVER_TEST_DB
!==
'
postgres
'
)
{
await
TestUtils
.
destroyAllDataPermanently
();
}
config
=
Config
.
get
(
'
test
'
);
config
.
schemaCache
.
clear
();
});
it
(
'
support 2d and 2dsphere
'
,
done
=>
{
const
coords
=
[
[
0
,
0
],
...
...
@@ -437,7 +444,7 @@ describe_only_db('mongo')('Parse.Polygon testing', () => {
// testings against REST API, use raw formats
const
polygon
=
{
__type
:
'
Polygon
'
,
coordinates
:
coords
};
const
location
=
{
__type
:
'
GeoPoint
'
,
latitude
:
10
,
longitude
:
10
};
const
databaseAdapter
=
new
MongoStorageAdapter
({
uri
:
mongoURI
})
;
const
databaseAdapter
=
config
.
database
.
adapter
;
return
reconfigureServer
({
appId
:
'
test
'
,
restAPIKey
:
'
rest
'
,
...
...
spec/ParseRelation.spec.js
浏览文件 @
b5fc0d59
...
...
@@ -172,7 +172,7 @@ describe('Parse.Relation testing', () => {
.
then
(
done
,
done
.
fail
);
});
it
_exclude_dbs
([
'
postgres
'
])
(
'
queries with relations
'
,
async
()
=>
{
it
(
'
queries with relations
'
,
async
()
=>
{
const
ChildObject
=
Parse
.
Object
.
extend
(
'
ChildObject
'
);
const
childObjects
=
[];
for
(
let
i
=
0
;
i
<
10
;
i
++
)
{
...
...
@@ -283,7 +283,7 @@ describe('Parse.Relation testing', () => {
});
});
it
_exclude_dbs
([
'
postgres
'
])
(
'
query on pointer and relation fields with equal
'
,
done
=>
{
it
(
'
query on pointer and relation fields with equal
'
,
done
=>
{
const
ChildObject
=
Parse
.
Object
.
extend
(
'
ChildObject
'
);
const
childObjects
=
[];
for
(
let
i
=
0
;
i
<
10
;
i
++
)
{
...
...
@@ -366,7 +366,7 @@ describe('Parse.Relation testing', () => {
});
});
it
_exclude_dbs
([
'
postgres
'
])
(
'
or queries on pointer and relation fields
'
,
done
=>
{
it
(
'
or queries on pointer and relation fields
'
,
done
=>
{
const
ChildObject
=
Parse
.
Object
.
extend
(
'
ChildObject
'
);
const
childObjects
=
[];
for
(
let
i
=
0
;
i
<
10
;
i
++
)
{
...
...
spec/SchemaPerformance.spec.js
浏览文件 @
b5fc0d59
const
Config
=
require
(
'
../lib/Config
'
);
const
MongoStorageAdapter
=
require
(
'
../lib/Adapters/Storage/Mongo/MongoStorageAdapter
'
).
default
;
const
mongoURI
=
'
mongodb://localhost:27017/parseServerMongoAdapterTestDatabase
'
;
describe
_only_db
(
'
mongo
'
)
(
'
Schema Performance
'
,
function
()
{
describe
(
'
Schema Performance
'
,
function
()
{
let
getAllSpy
;
let
config
;
beforeEach
(
async
()
=>
{
config
=
Config
.
get
(
'
test
'
);
config
.
schemaCache
.
clear
();
const
databaseAdapter
=
new
MongoStorageAdapter
({
uri
:
mongoURI
})
;
const
databaseAdapter
=
config
.
database
.
adapter
;
await
reconfigureServer
({
databaseAdapter
});
getAllSpy
=
spyOn
(
databaseAdapter
,
'
getAllClasses
'
).
and
.
callThrough
();
});
...
...
@@ -204,6 +202,6 @@ describe_only_db('mongo')('Schema Performance', function () {
{},
config
.
database
);
expect
(
getAllSpy
.
calls
.
count
()).
toBe
(
0
);
expect
(
getAllSpy
.
calls
.
count
()).
toBe
(
2
);
});
});
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录