fix: Flash of empty state on paginated lists (#3351)
* fix: Flash of empty state on paginated lists fix: Typing of PaginatedList to generic * test * test
This commit is contained in:
@@ -4,6 +4,12 @@ import CollectionUser from "./CollectionUser";
|
||||
import UserAuthentication from "./UserAuthentication";
|
||||
|
||||
beforeEach(() => flushdb());
|
||||
beforeAll(() => {
|
||||
jest.useFakeTimers().setSystemTime(new Date("2018-01-02T00:00:00.000Z"));
|
||||
});
|
||||
afterAll(() => {
|
||||
jest.useRealTimers();
|
||||
});
|
||||
|
||||
describe("user model", () => {
|
||||
describe("destroy", () => {
|
||||
|
||||
@@ -11,6 +11,7 @@ Object {
|
||||
"isViewer": false,
|
||||
"lastActiveAt": undefined,
|
||||
"name": "Test User",
|
||||
"updatedAt": undefined,
|
||||
}
|
||||
`;
|
||||
|
||||
@@ -25,5 +26,6 @@ Object {
|
||||
"isViewer": false,
|
||||
"lastActiveAt": undefined,
|
||||
"name": "Test User",
|
||||
"updatedAt": undefined,
|
||||
}
|
||||
`;
|
||||
|
||||
@@ -6,5 +6,6 @@ export default function present(key: ApiKey) {
|
||||
name: key.name,
|
||||
secret: key.secret,
|
||||
createdAt: key.createdAt,
|
||||
updatedAt: key.updatedAt,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -13,5 +13,6 @@ export default function present(data: FileOperation) {
|
||||
collectionId: data.collectionId,
|
||||
user: presentUser(data.user),
|
||||
createdAt: data.createdAt,
|
||||
updatedAt: data.updatedAt,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ type UserPresentation = {
|
||||
name: string;
|
||||
avatarUrl: string | null | undefined;
|
||||
createdAt: Date;
|
||||
updatedAt: Date;
|
||||
lastActiveAt: Date | null;
|
||||
color: string;
|
||||
isAdmin: boolean;
|
||||
@@ -31,6 +32,7 @@ export default (
|
||||
isSuspended: user.isSuspended,
|
||||
isViewer: user.isViewer,
|
||||
createdAt: user.createdAt,
|
||||
updatedAt: user.updatedAt,
|
||||
lastActiveAt: user.lastActiveAt,
|
||||
};
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ Object {
|
||||
"language": "en_US",
|
||||
"lastActiveAt": null,
|
||||
"name": "User 1",
|
||||
"updatedAt": "2018-01-02T00:00:00.000Z",
|
||||
},
|
||||
"ok": true,
|
||||
"policies": Array [
|
||||
@@ -68,6 +69,7 @@ Object {
|
||||
"language": "en_US",
|
||||
"lastActiveAt": null,
|
||||
"name": "User 1",
|
||||
"updatedAt": "2018-01-02T00:00:00.000Z",
|
||||
},
|
||||
"ok": true,
|
||||
"policies": Array [
|
||||
@@ -104,6 +106,7 @@ Object {
|
||||
"language": "en_US",
|
||||
"lastActiveAt": null,
|
||||
"name": "User 1",
|
||||
"updatedAt": "2018-01-02T00:00:00.000Z",
|
||||
},
|
||||
"ok": true,
|
||||
"policies": Array [
|
||||
@@ -140,6 +143,7 @@ Object {
|
||||
"language": "en_US",
|
||||
"lastActiveAt": null,
|
||||
"name": "User 1",
|
||||
"updatedAt": "2018-01-02T00:00:00.000Z",
|
||||
},
|
||||
"ok": true,
|
||||
"policies": Array [
|
||||
@@ -194,6 +198,7 @@ Object {
|
||||
"language": "en_US",
|
||||
"lastActiveAt": null,
|
||||
"name": "User 1",
|
||||
"updatedAt": "2018-01-02T00:00:00.000Z",
|
||||
},
|
||||
"ok": true,
|
||||
"policies": Array [
|
||||
@@ -257,6 +262,7 @@ Object {
|
||||
"language": "en_US",
|
||||
"lastActiveAt": null,
|
||||
"name": "User 1",
|
||||
"updatedAt": "2018-01-02T00:00:00.000Z",
|
||||
},
|
||||
"ok": true,
|
||||
"policies": Array [
|
||||
|
||||
@@ -6,7 +6,14 @@ import { flushdb, seed } from "@server/test/support";
|
||||
const app = webService();
|
||||
const server = new TestServer(app.callback());
|
||||
beforeEach(() => flushdb());
|
||||
afterAll(() => server.close());
|
||||
|
||||
beforeAll(() => {
|
||||
jest.useFakeTimers().setSystemTime(new Date("2018-01-02T00:00:00.000Z"));
|
||||
});
|
||||
afterAll(() => {
|
||||
jest.useRealTimers();
|
||||
return server.close();
|
||||
});
|
||||
|
||||
describe("#users.list", () => {
|
||||
it("should allow filtering by user name", async () => {
|
||||
|
||||
@@ -135,7 +135,8 @@ export async function buildUser(overrides: Partial<User> = {}) {
|
||||
name: `User ${count}`,
|
||||
username: `user${count}`,
|
||||
createdAt: new Date("2018-01-01T00:00:00.000Z"),
|
||||
lastActiveAt: new Date("2018-01-01T00:00:00.000Z"),
|
||||
updatedAt: new Date("2018-01-02T00:00:00.000Z"),
|
||||
lastActiveAt: new Date("2018-01-03T00:00:00.000Z"),
|
||||
authentications: [
|
||||
{
|
||||
authenticationProviderId: authenticationProvider!.id,
|
||||
|
||||
Reference in New Issue
Block a user