Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 6 additions & 18 deletions __tests__/pages/api/findresources.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import resources from "./resources.json"
const originalEnv = process.env;

global.fetch = jest.fn((url) => {
if (url.includes("data.mongodb-api")) {
if (url.includes("api.gem5")) {
return Promise.resolve({
json: () => Promise.resolve({
'documents': [],
}),
json: () => Promise.resolve(
[],
),
})
}

Expand All @@ -18,14 +18,6 @@ global.fetch = jest.fn((url) => {
})
}

if (url.includes("realm.mongodb.com")) {
return Promise.resolve({
json: () => Promise.resolve({
"access_token": ""
}),
})
}

return Promise.resolve({
json: () => Promise.resolve({
"error": "Resource not found"
Expand Down Expand Up @@ -146,9 +138,7 @@ describe('findResources', () => {
dataSource: "gem5-vision",
database: "gem5-vision",
collection: "resources",
url: "https://data.mongodb-api.com/app/data-ejhjf/endpoint/data/v1",
authUrl: "https://realm.mongodb.com/api/client/v2.0/app/data-ejhjf/auth/providers/api-key/login",
apiKey: "pKkhRJGJaQ3NdJyDt69u4GPGQTDUIhHlx4a3lrKUNx2hxuc8uba8NrP3IVRvlzlo",
url: "https://api.gem5.org/api/resources",
isMongo: true,
}
}
Expand All @@ -169,9 +159,7 @@ describe('findResources', () => {
dataSource: "gem5-vision",
database: "gem5-vision",
collection: "resources",
url: "https://data.mongodb-api.com/app/data-ejhjf/endpoint/data/v1",
authUrl: "https://realm.mongodb.com/api/client/v2.0/app/data-ejhjf/auth/providers/api-key/login",
apiKey: "pKkhRJGJaQ3NdJyDt69u4GPGQTDUIhHlx4a3lrKUNx2hxuc8uba8NrP3IVRvlzlo",
url: "https://api.gem5.org/api/resources",
isMongo: true,
}
}
Expand Down
20 changes: 4 additions & 16 deletions __tests__/pages/api/getVersions.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import resources from "./resources.json"
const originalEnv = process.env;

global.fetch = jest.fn((url) => {
if (url.includes("data.mongodb-api")) {
if (url.includes("api.gem5")) {
return Promise.resolve({
status: 200,
json: () => Promise.resolve({
'documents': [
json: () => Promise.resolve(
[
{
"category": "simpoint",
"id": "batman",
Expand All @@ -18,7 +18,6 @@ global.fetch = jest.fn((url) => {
"database": "db1"
}
]
}
),
})
}
Expand All @@ -30,15 +29,6 @@ global.fetch = jest.fn((url) => {
})
}

if (url.includes("realm.mongodb.com")) {
return Promise.resolve({
status: 200,
json: () => Promise.resolve({
"access_token": ""
}),
})
}

return Promise.resolve({
status: 200,
json: () => Promise.resolve({
Expand Down Expand Up @@ -107,9 +97,7 @@ describe("getVersions", () => {
dataSource: "gem5-vision",
database: "gem5-vision",
collection: "versions_test",
url: "https://data.mongodb-api.com/app/data-ejhjf/endpoint/data/v1",
authUrl: "https://realm.mongodb.com/api/client/v2.0/app/data-ejhjf/auth/providers/api-key/login",
apiKey: "pKkhRJGJaQ3NdJyDt69u4GPGQTDUIhHlx4a3lrKUNx2hxuc8uba8NrP3IVRvlzlo",
url: "https://api.gem5.org/api/resources",
isMongo: true,
},
}
Expand Down
23 changes: 5 additions & 18 deletions __tests__/pages/api/getfilters.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,20 @@ import resources from "./resources.json"
const originalEnv = process.env;

global.fetch = jest.fn((url) => {
if (url.includes("data.mongodb-api")) {
if (url.includes("api.gem5")) {
return Promise.resolve({
status: 200,
json: () => Promise.resolve({
'documents': [
json: () => Promise.resolve(
{
"category": ["simpoint", "file"],
"id": "batman",
"architecture": ["X86", "ARM", null],
"architecture": ["X86", "ARM"],
"tags": [],
"resource_version": "1.0.0",
"gem5_versions": ["22.0"],
"database": "db1",
},
]
}),
),
})
}

Expand All @@ -30,15 +28,6 @@ global.fetch = jest.fn((url) => {
})
}

if (url.includes("realm.mongodb.com")) {
return Promise.resolve({
status: 200,
json: () => Promise.resolve({
"access_token": ""
}),
})
}

return Promise.resolve({
status: 200,
json: () => Promise.resolve({
Expand Down Expand Up @@ -85,9 +74,7 @@ describe('getFilters', () => {
dataSource: "gem5-vision",
database: "gem5-vision",
collection: "versions_test",
url: "https://data.mongodb-api.com/app/data-ejhjf/endpoint/data/v1",
authUrl: "https://realm.mongodb.com/api/client/v2.0/app/data-ejhjf/auth/providers/api-key/login",
apiKey: "pKkhRJGJaQ3NdJyDt69u4GPGQTDUIhHlx4a3lrKUNx2hxuc8uba8NrP3IVRvlzlo",
url: "https://api.gem5.org/api/resources",
isMongo: true,
},
}
Expand Down
21 changes: 5 additions & 16 deletions __tests__/pages/api/getresource.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import resources from "./resources.json"
const originalEnv = process.env;

global.fetch = jest.fn((url) => {
if (url.includes("data.mongodb-api")) {
if (url.includes("api.gem5")) {
return Promise.resolve({
status: 200,
json: () => Promise.resolve({
'documents': [{
json: () => Promise.resolve(
[{
category: 'simpoint',
id: 'batman',
description: 'Simpoints for running the \'x86-print-this\' resource with the parameters `"print this" 15000`. This is encapsulated in the \'x86-print-this-15000-with-simpoints\' workload.',
Expand All @@ -32,7 +32,7 @@ global.fetch = jest.fn((url) => {
workloads_mapping: [],
database: 'db1'
}],
}),
),
})
}

Expand All @@ -43,15 +43,6 @@ global.fetch = jest.fn((url) => {
})
}

if (url.includes("realm.mongodb.com")) {
return Promise.resolve({
status: 200,
json: () => Promise.resolve({
"access_token": ""
}),
})
}

return Promise.resolve({
status: 200,
json: () => Promise.resolve({
Expand Down Expand Up @@ -187,9 +178,7 @@ describe('getResource', () => {
dataSource: "gem5-vision",
database: "gem5-vision",
collection: "resources",
url: "https://data.mongodb-api.com/app/data-ejhjf/endpoint/data/v1",
authUrl: "https://realm.mongodb.com/api/client/v2.0/app/data-ejhjf/auth/providers/api-key/login",
apiKey: "pKkhRJGJaQ3NdJyDt69u4GPGQTDUIhHlx4a3lrKUNx2hxuc8uba8NrP3IVRvlzlo",
url: "https://api.gem5.org/api/resources",
isMongo: true,
}
}
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/searchPage.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ describe('Search page', () => {
cy.interceptAll()
cy.visit('/resources')
cy.waitAuto()
cy.waitAuto()
window.localStorage.setItem('CookieConsent', "{\"userPreference\":\"all\"}")
})

Expand Down Expand Up @@ -112,6 +111,7 @@ describe('Search page', () => {
})

it('checks if changing page size works', () => {
// cy.waitAuto()
cy.get('.results-sortBy-row').find('select').first().select('25')
cy.waitAuto()
// cy.wait(['@kiwi', '@resources', '@mongo'])
Expand Down
48 changes: 22 additions & 26 deletions cypress/fixtures/filters.json
Original file line number Diff line number Diff line change
@@ -1,28 +1,24 @@
{
"documents": [
{
"_id": null,
"category": [
"workload",
"simpoint",
"disk_image",
"binary",
"checkpoint",
"bootloader",
"resource",
"kernel"
],
"architecture": [
"X86",
"ARM",
"MIPS",
"RISCV",
"POWER",
"SPARC"
],
"gem5_versions": [
"23.0"
]
}
"_id": null,
"category": [
"workload",
"simpoint",
"disk_image",
"binary",
"checkpoint",
"bootloader",
"resource",
"kernel"
],
"architecture": [
"X86",
"ARM",
"MIPS",
"RISCV",
"POWER",
"SPARC"
],
"gem5_versions": [
"23.0"
]
}
}
Loading