-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from fumeapp/cleanup
⚗️ tons of cleanup
- Loading branch information
Showing
14 changed files
with
35 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
declare module '#auth-utils' { | ||
interface User extends import('~/types/models').User | ||
} | ||
interface User extends import('~/types/models').User {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
# Please do not edit this file manually | ||
# It should be added in your version-control system (i.e. Git) | ||
provider = "mysql" | ||
provider = "mysql" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,9 +37,8 @@ describe('/api/cartridge', async () => { | |
|
||
it('delete /api/cartridge/:id - delete a cartridge', async () => { | ||
if (!cartridges[0]) throw new Error('Cartridge not found') | ||
const { remove, get } = await actingAs('[email protected]') | ||
const { remove, notFound } = await actingAs('[email protected]') | ||
await remove<Cartridge>(`/api/cartridge/${cartridges[0]?.id}`) | ||
try { await get<Cartridge[]>(`/api/cartridge/${cartridges[0]?.id}`) } | ||
catch (error: any) { expect(error.response.status).toBe(404) } | ||
expect(await notFound('GET', `/api/cartridge/${cartridges[0]?.id}`)).toBe(404) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,10 +43,8 @@ describe ('/api/user/:user/cartridge admin-only apiResource', async () => { | |
|
||
it ('delete /api/user/:user/cartridge/:id - delete a cartridge', async () => { | ||
if (!cartridges[0]) throw new Error('Cartridge not found') | ||
const { remove, get } = await actingAs('[email protected]') | ||
|
||
const { remove, notFound } = await actingAs('[email protected]') | ||
await remove<Cartridge>(`/api/user/1/cartridge/${cartridges[0]?.id}`) | ||
try { await get<Cartridge[]>(`/api/user/1/cartridge/${cartridges[0]?.id}`) } | ||
catch (error: any) { expect(error.response.status).toBe(404) } | ||
expect(await notFound('GET', `/api/user/1/cartridge/${cartridges[0]?.id}`)).toBe(404) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,9 +37,8 @@ describe('/api/pen', async () => { | |
|
||
it ('delete /api/pen/:id - delete a pen', async () => { | ||
if (!pens[0]) throw new Error('Pen not found') | ||
const { remove, get } = await actingAs('[email protected]') | ||
const { remove, notFound } = await actingAs('[email protected]') | ||
await remove<Pen>(`/api/pen/${pens[0]?.id}`) | ||
try { await get<Pen[]>(`/api/pen/${pens[0]?.id}`) } | ||
catch (error: any) { expect(error.response.status).toBe(404) } | ||
expect(await notFound('GET', `/api/pen/${pens[0]?.id}`)).toBe(404) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,10 +38,8 @@ describe ('/api/user/:user/pen admin-only apiResource', async () => { | |
|
||
it ('remove /api/user/:user/pen/:id - delete a pen', async () => { | ||
if (!pens[0]) throw new Error('Pen not found') | ||
const { remove, get } = await actingAs('[email protected]') | ||
|
||
const { remove, notFound } = await actingAs('[email protected]') | ||
await remove<Pen>(`/api/user/1/pen/${pens[0]?.id}`) | ||
try { await get<Pen[]>(`/api/user/1/pen/${pens[0]?.id}`) } | ||
catch (error: any) { expect(error.response.status).toBe(404) } | ||
expect(await notFound('GET', `/api/user/1/pen/${pens[0]?.id}`)).toBe(404) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,9 +42,8 @@ describe('/api/shot', async () => { | |
|
||
it ('delete /api/shot/:id - delete a shot', async () => { | ||
if (!shots[0]) throw new Error('Shot not found') | ||
const { remove, get } = await actingAs('[email protected]') | ||
const { remove, notFound } = await actingAs('[email protected]') | ||
await remove<Shot>(`/api/shot/${shots[0]?.id}`) | ||
try { await get<Shot[]>(`/api/shot/${shots[0]?.id}`) } | ||
catch (error: any) { expect(error.response.status).toBe(404) } | ||
expect(await notFound('GET', `/api/shot/${shots[0]?.id}`)).toBe(404) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,9 @@ import type { User } from '~/types/models' | |
describe('/api/me and /api/user', async () => { | ||
await setup(setupConfig()) | ||
it('/api/me should 401', async () => { | ||
try { await $fetch('/api/me') } | ||
try { | ||
await $fetch('/api/me') | ||
} | ||
catch (error: any) { expect(error.response.status).toBe(401) } | ||
}) | ||
|
||
|
@@ -17,9 +19,9 @@ describe('/api/me and /api/user', async () => { | |
expect(response.data.email).toEqual(user.session.email) | ||
}) | ||
|
||
it ('get /api/user isAdmin: false - 404', async () => { | ||
try { await (await actingAs('[email protected]')).get('/api/all/user') } | ||
catch (error: any) { expect(error.response.status).toBe(404) } | ||
it ('get /api/all/user isAdmin: false - 404', async () => { | ||
const { notFound } = await actingAs('[email protected]') | ||
expect(await notFound('GET', '/api/all/user')).toBe(404) | ||
}) | ||
|
||
it ('get /api/user GET', async () => { | ||
|