test: add coverage on collaborative editing (#1747)

This commit is contained in:
Himself65
2023-03-29 17:49:13 -05:00
committed by GitHub
parent 5500b3b1ed
commit 926bf49b26
6 changed files with 111 additions and 1 deletions
+32
View File
@@ -5,6 +5,38 @@ const userA = require('../fixtures/userA.json');
// eslint-disable-next-line @typescript-eslint/no-var-requires
const userB = require('../fixtures/userB.json');
// eslint-disable-next-line @typescript-eslint/no-var-requires
const user1 = require('@affine-test/fixtures/built-in-user1.json');
// eslint-disable-next-line @typescript-eslint/no-var-requires
const user2 = require('@affine-test/fixtures/built-in-user2.json');
export async function getBuiltInUser() {
return Promise.all([
fetch('http://localhost:3000/api/user/token', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
type: 'DebugLoginUser',
email: user1.email,
password: user1.password,
}),
}).then(r => r.json()),
fetch('http://localhost:3000/api/user/token', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
type: 'DebugLoginUser',
email: user2.email,
password: user2.password,
}),
}).then(r => r.json()),
]);
}
export async function createFakeUser() {
try {
const response = await Promise.all([