chore(server) Add user FK to album entity (#1569)

This commit is contained in:
Alex
2023-02-06 20:47:06 -06:00
committed by GitHub
parent ac39ebddc0
commit 3cc4af5947
14 changed files with 173 additions and 96 deletions

View File

@@ -37,20 +37,19 @@ describe('Album', () => {
});
describe('with auth', () => {
let authUser: AuthUserDto;
let userService: UserService;
let authService: AuthService;
let authUser: AuthUserDto;
beforeAll(async () => {
const builder = Test.createTestingModule({ imports: [AppModule] });
authUser = getAuthUser(); // set default auth user
authUser = getAuthUser();
const moduleFixture: TestingModule = await authCustom(builder, () => authUser).compile();
app = moduleFixture.createNestApplication();
userService = app.get(UserService);
authService = app.get(AuthService);
database = app.get(DataSource);
await app.init();
});
@@ -58,25 +57,25 @@ describe('Album', () => {
await app.close();
});
describe('with empty DB', () => {
afterEach(async () => {
await clearDb(database);
});
// TODO - Until someone figure out how to passed in a logged in user to the request.
// describe('with empty DB', () => {
// it('creates an album', async () => {
// const data: CreateAlbumDto = {
// albumName: 'first albbum',
// };
it('creates an album', async () => {
const data: CreateAlbumDto = {
albumName: 'first albbum',
};
const { status, body } = await _createAlbum(app, data);
expect(status).toEqual(201);
expect(body).toEqual(
expect.objectContaining({
ownerId: authUser.id,
albumName: data.albumName,
}),
);
});
});
// const { status, body } = await _createAlbum(app, data);
// expect(status).toEqual(201);
// expect(body).toEqual(
// expect.objectContaining({
// ownerId: authUser.id,
// albumName: data.albumName,
// }),
// );
// });
// });
describe('with albums in DB', () => {
const userOneShared = 'userOneShared';