Skip to content

Commit

Permalink
fix lint and fixture issues
Browse files Browse the repository at this point in the history
  • Loading branch information
gidjin committed Dec 20, 2023
1 parent 7952524 commit 0cc6b2b
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
9 changes: 9 additions & 0 deletions src/__fixtures__/authUsers.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { ObjectId } from 'bson'
import { DateTime } from 'luxon'
import type { SessionUser, PortalUser, Collection, Widget } from 'types'

const mockNews: Widget = {
Expand Down Expand Up @@ -111,6 +112,7 @@ export const testPortalUser1: PortalUser = {
],
displayName: 'BERNADETTE CAMPBELL',
theme: 'light',
lastLoginAt: DateTime.now().toISO()!,
}

export const portalUserMaxedOutCollection: PortalUser = {
Expand Down Expand Up @@ -156,6 +158,7 @@ export const portalUserMaxedOutCollection: PortalUser = {
],
displayName: 'BERNADETTE CAMPBELL',
theme: 'light',
lastLoginAt: DateTime.now().toISO()!,
}

export const portalUserWithExampleCollection: PortalUser = {
Expand Down Expand Up @@ -194,6 +197,7 @@ export const portalUserWithExampleCollection: PortalUser = {
],
displayName: 'BERNADETTE CAMPBELL',
theme: 'light',
lastLoginAt: DateTime.now().toISO()!,
}

const mockCollectionWithGuardianIdeal: Widget = {
Expand All @@ -207,6 +211,7 @@ export const portalUserGuardianIdeal: PortalUser = {
mySpace: [mockCollectionWithGuardianIdeal],
displayName: 'BERNADETTE CAMPBELL',
theme: 'dark',
lastLoginAt: DateTime.now().toISO()!,
}

const mockCollectionWithFeaturedShortcuts: Widget = {
Expand All @@ -220,6 +225,7 @@ export const portalUserFeaturedShortcuts: PortalUser = {
mySpace: [mockCollectionWithFeaturedShortcuts],
displayName: 'BERNADETTE CAMPBELL',
theme: 'dark',
lastLoginAt: DateTime.now().toISO()!,
}

const mockCollection: Collection = {
Expand Down Expand Up @@ -260,13 +266,15 @@ export const portalUserCollectionLimit: PortalUser = {
mySpace: maxCollections,
displayName: 'BERNADETTE CAMPBELL',
theme: 'light',
lastLoginAt: DateTime.now().toISO()!,
}

export const portalUserAlmostAtCollectionLimit: PortalUser = {
userId: '[email protected]',
mySpace: almostMaxCollections,
displayName: 'BERNADETTE CAMPBELL',
theme: 'light',
lastLoginAt: DateTime.now().toISO()!,
}

export const portalUserCollectionLimitWithAllAdditionalWidgets: PortalUser = {
Expand All @@ -279,6 +287,7 @@ export const portalUserCollectionLimitWithAllAdditionalWidgets: PortalUser = {
],
displayName: 'BERNADETTE CAMPBELL',
theme: 'light',
lastLoginAt: DateTime.now().toISO()!,
}

export const portalUserNoCollections: PortalUser = {
Expand Down
2 changes: 1 addition & 1 deletion src/models/User.test.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { Db, MongoClient } from 'mongodb'
import { DateTime, Settings } from 'luxon'

import User from './User'
import {
exampleCollection,
exampleCollection1,
} from '__fixtures__/newPortalUser'
import { WIDGETS } from 'constants/index'
import { DateTime, Settings } from 'luxon'

let connection: typeof MongoClient
let db: typeof Db
Expand Down
2 changes: 1 addition & 1 deletion src/models/User.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Context } from '@apollo/client'
import { DateTime } from 'luxon'

import { CollectionModel } from './Collection'
import { MySpaceModel } from './MySpace'
Expand All @@ -8,7 +9,6 @@ import type {
WidgetInputType,
} from 'types/index'
import { WIDGETS } from 'constants/index'
import { DateTime } from 'luxon'

type EditDisplayName = {
userId: string
Expand Down
2 changes: 1 addition & 1 deletion src/pages/api/graphql.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { ApolloServer } from '@apollo/server'
import { startServerAndCreateNextHandler } from '@as-integrations/next'
import { gql } from 'graphql-tag'
import { GraphQLError } from 'graphql'
import { DateTime } from 'luxon'
import { typeDefs } from '../../schema'
import WeatherAPI from './dataSources/weather'
import KeystoneAPI from './dataSources/keystone'
Expand All @@ -14,7 +15,6 @@ import clientPromise from 'lib/mongodb'
import { getSession } from 'lib/session'
import User from 'models/User'
import { EXAMPLE_COLLECTION_ID } from 'constants/index'
import { DateTime } from 'luxon'

// To create a new user, we need the example collection from Keystone
const getExampleCollection = async () => {
Expand Down

0 comments on commit 0cc6b2b

Please sign in to comment.