Fix search result ordering
Add support for returning your own drafts in results Added regression tests
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// @flow
|
||||
import { Share, Team, User } from '../models';
|
||||
import { Share, Team, User, Document, Collection } from '../models';
|
||||
import uuid from 'uuid';
|
||||
|
||||
let count = 0;
|
||||
@@ -45,3 +45,53 @@ export async function buildUser(overrides: Object = {}) {
|
||||
...overrides,
|
||||
});
|
||||
}
|
||||
|
||||
export async function buildCollection(overrides: Object = {}) {
|
||||
count++;
|
||||
|
||||
if (!overrides.teamId) {
|
||||
const team = await buildTeam();
|
||||
overrides.teamId = team.id;
|
||||
}
|
||||
|
||||
if (!overrides.userId) {
|
||||
const user = await buildUser();
|
||||
overrides.userId = user.id;
|
||||
}
|
||||
|
||||
return Collection.create({
|
||||
name: 'Test Collection',
|
||||
description: 'Test collection description',
|
||||
creatorId: overrides.userId,
|
||||
type: 'atlas',
|
||||
...overrides,
|
||||
});
|
||||
}
|
||||
|
||||
export async function buildDocument(overrides: Object = {}) {
|
||||
count++;
|
||||
|
||||
if (!overrides.teamId) {
|
||||
const team = await buildTeam();
|
||||
overrides.teamId = team.id;
|
||||
}
|
||||
|
||||
if (!overrides.userId) {
|
||||
const user = await buildUser();
|
||||
overrides.userId = user.id;
|
||||
}
|
||||
|
||||
if (!overrides.atlasId) {
|
||||
const collection = await buildCollection(overrides);
|
||||
overrides.atlasId = collection.id;
|
||||
}
|
||||
|
||||
return Document.create({
|
||||
title: `Document ${count}`,
|
||||
text: 'This is the text in an example document',
|
||||
publishedAt: new Date(),
|
||||
lastModifiedById: overrides.userId,
|
||||
createdById: overrides.userId,
|
||||
...overrides,
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user