Skip to content

Commit a3e93c6

Browse files
Add test to sign up two anonymous users
1 parent 38b8b6e commit a3e93c6

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

spec/RestCreate.spec.js

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,50 @@ describe('rest create', () => {
5757
});
5858
});
5959

60+
it('handles anonymous user signup', (done) => {
61+
var data1 = {
62+
authData: {
63+
anonymous: {
64+
id: '00000000-0000-0000-0000-000000000000'
65+
}
66+
}
67+
};
68+
var data2 = {
69+
authData: {
70+
anonymous: {
71+
id: '00000000-0000-0000-0000-000000000001'
72+
}
73+
}
74+
};
75+
var username1;
76+
rest.create(config, auth.nobody(config), '_User', data1)
77+
.then((r) => {
78+
expect(typeof r.response.objectId).toEqual('string');
79+
expect(typeof r.response.createdAt).toEqual('string');
80+
expect(typeof r.response.sessionToken).toEqual('string');
81+
return rest.create(config, auth.nobody(config), '_User', data1);
82+
}).then((r) => {
83+
expect(typeof r.response.objectId).toEqual('string');
84+
expect(typeof r.response.createdAt).toEqual('string');
85+
expect(typeof r.response.username).toEqual('string');
86+
expect(typeof r.response.updatedAt).toEqual('string');
87+
username1 = r.response.username;
88+
return rest.create(config, auth.nobody(config), '_User', data2);
89+
}).then((r) => {
90+
expect(typeof r.response.objectId).toEqual('string');
91+
expect(typeof r.response.createdAt).toEqual('string');
92+
expect(typeof r.response.sessionToken).toEqual('string');
93+
return rest.create(config, auth.nobody(config), '_User', data2);
94+
}).then((r) => {
95+
expect(typeof r.response.objectId).toEqual('string');
96+
expect(typeof r.response.createdAt).toEqual('string');
97+
expect(typeof r.response.username).toEqual('string');
98+
expect(typeof r.response.updatedAt).toEqual('string');
99+
expect(r.response.username).not.toEqual(username1);
100+
done();
101+
});
102+
});
103+
60104
it('test facebook signup and login', (done) => {
61105
var data = {
62106
authData: {

0 commit comments

Comments
 (0)