@@ -34,11 +34,11 @@
I've checked the link. Skip ahead
-

+
diff --git a/test/end-to-end/LinkAudit.test.ts b/test/end-to-end/LinkAudit.test.ts
index b345902e6..6cfd69002 100644
--- a/test/end-to-end/LinkAudit.test.ts
+++ b/test/end-to-end/LinkAudit.test.ts
@@ -93,8 +93,6 @@ test('Changing the link owner should update the link history with Link Owner upd
.pressKey('ctrl+a delete')
.typeText(linkTransferField, `${transferEmail}`)
.click(transferButton)
- // Close drawer
- await t.click(closeButtonSnackBar)
// Sign out
await t.click(signOutButton)
// Login using the new link owner
diff --git a/test/end-to-end/UrlCreation.test.ts b/test/end-to-end/UrlCreation.test.ts
index 8d7622060..be5aa87f2 100644
--- a/test/end-to-end/UrlCreation.test.ts
+++ b/test/end-to-end/UrlCreation.test.ts
@@ -325,7 +325,7 @@ test('The update file test', async (t) => {
const generatedfileUrl = await shortUrlTextField.value
const fileRow = Selector(`h6[title="${generatedfileUrl}"]`)
- const directoryPath = `${process.env.HOME}/Downloads/${generatedfileUrl}.pdf`
+ const directoryPath = `${process.env.HOME}/Downloads/${generatedfileUrl}.csv`
// Generate 1mb file
await createEmptyFileOfSize(dummyFilePath, smallFileSize)
diff --git a/test/end-to-end/util/config.ts b/test/end-to-end/util/config.ts
index 9fa3fbb7e..69b8c9634 100644
--- a/test/end-to-end/util/config.ts
+++ b/test/end-to-end/util/config.ts
@@ -16,8 +16,8 @@ export const dummyMaliciousFilePath = './test/end-to-end/eicar.com.txt'
export const dummyMaliciousRelativePath = './eicar.com.txt'
export const dummyFilePath = './test/end-to-end/anotherDummy.txt'
export const dummyRelativePath = './anotherDummy.txt'
-export const dummyChangedFilePath = './test/end-to-end/changedDummy.pdf'
-export const dummyRelativeChangedFilePath = './changedDummy.pdf'
+export const dummyChangedFilePath = './test/end-to-end/changedDummy.csv'
+export const dummyRelativeChangedFilePath = './changedDummy.csv'
export const dummyBulkCsv = './test/end-to-end/bulkCsv.csv'
export const dummyBulkCsvRelativePath = './bulkCsv.csv'
export const smallFileSize = 1024 * 1024 * 1
diff --git a/test/integration/util/db.ts b/test/integration/util/db.ts
index a7b94da4e..822a2e2a9 100644
--- a/test/integration/util/db.ts
+++ b/test/integration/util/db.ts
@@ -21,7 +21,9 @@ export const createDbUser = async (
)
} catch (e) {
throw new Error(
- `Failed to create user with email ${email} for integration tests: ${e.message}`,
+ `Failed to create user with email ${email} for integration tests: ${
+ (e as Error).message
+ }`,
)
}
}
@@ -49,7 +51,9 @@ export const deleteDbUser = async (email: string): Promise
=> {
)
} catch (e) {
throw new Error(
- `Failed to delete user with email ${email} for integration tests: ${e.message}`,
+ `Failed to delete user with email ${email} for integration tests: ${
+ (e as Error).message
+ }`,
)
}
}
diff --git a/test/server/api/StatisticsRoute.test.ts b/test/server/api/StatisticsRoute.test.ts
deleted file mode 100644
index 704db2f68..000000000
--- a/test/server/api/StatisticsRoute.test.ts
+++ /dev/null
@@ -1,31 +0,0 @@
-import request from 'supertest'
-import { container } from '../../../src/server/util/inversify'
-import { DependencyIds } from '../../../src/server/constants'
-import { StatisticsRepository } from '../../../src/server/modules/statistics/interfaces'
-
-const getGlobalStatistics = jest.fn()
-getGlobalStatistics.mockResolvedValue({
- linkCount: 1,
- userCount: 2,
- clickCount: 3,
-})
-// Binds mockups before binding default
-container
- .bind(DependencyIds.statisticsRepository)
- .toConstantValue({ getGlobalStatistics })
-
-// Importing setup app
-// eslint-disable-next-line import/first
-import app from './setup'
-
-describe('GET /api/stats', () => {
- test('get statistics', async (done) => {
- const res = await request(app).get('/api/stats')
- expect(res.status).toBe(200)
- expect(res.ok).toBe(true)
- expect(Object.keys(res.body).sort()).toEqual(
- ['linkCount', 'clickCount', 'userCount'].sort(),
- )
- done()
- })
-})
diff --git a/test/server/config.ts b/test/server/config.ts
index 9f7d69c9d..c53beeec2 100644
--- a/test/server/config.ts
+++ b/test/server/config.ts
@@ -54,4 +54,7 @@ jest.mock('../../src/server/config', () => ({
gaTrackingId: 'UA-000000-2',
otpRateLimit: 5,
ogHostname: 'go.gov.sg',
+ userCount: 1,
+ clickCount: 2,
+ linkCount: 3,
}))
diff --git a/test/server/mocks/repositories/UrlRepository.ts b/test/server/mocks/repositories/UrlRepository.ts
index f9b46f255..b488d2b7e 100644
--- a/test/server/mocks/repositories/UrlRepository.ts
+++ b/test/server/mocks/repositories/UrlRepository.ts
@@ -39,6 +39,10 @@ export class UrlRepositoryMock implements UrlRepositoryInterface {
throw new Error('Not implemented')
}
+ isShortUrlAvailable: (shortUrl: string) => Promise = () => {
+ throw new Error('Not implemented')
+ }
+
getLongUrl: (shortUrl: string) => Promise = () => {
throw new Error('Not implemented')
}
diff --git a/webpack.config.ts b/webpack.config.ts
index 51fe5a336..932eec3f7 100644
--- a/webpack.config.ts
+++ b/webpack.config.ts
@@ -110,7 +110,7 @@ module.exports = () => {
'!/(assets/**|bundle.js|favicon*)': 'http://localhost:8080',
},
historyApiFallback: true,
- disableHostCheck: true,
+ allowedHosts: 'all',
},
devtool: 'source-map',
plugins: [