Skip to content

Commit

Permalink
Merge branch 'develop' into dependabot/npm_and_yarn/apps/dfda-1/cypre…
Browse files Browse the repository at this point in the history
…ss/request-and-cypress-3.0.1
  • Loading branch information
mikepsinn authored Mar 26, 2024
2 parents b31cdcb + ab96249 commit d4e2b3b
Show file tree
Hide file tree
Showing 67 changed files with 12,374 additions and 3,037 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/text-2-measurements.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Text2Measurements tests

on:
push:
paths:
- 'libs/text-2-measurements/**'
pull_request:
paths:
- 'libs/text-2-measurements/**'

jobs:
test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Use Node.js
uses: actions/setup-node@v2
with:
node-version: '14'

- name: Install Dependencies
run: |
cd libs/text-2-measurements
npm ci
- name: Run Tests
run: |
cd libs/text-2-measurements
npm test
6 changes: 3 additions & 3 deletions apps/dfda-1/public/app/tests/mocha/integration.mocha.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -873,7 +873,7 @@ describe("Login", function () {
// TODO: Figure out how to preserve cookie session between requests in tests
this.timeout(5000)
let request = { body: { email: "[email protected]", password: "testing123" } };
const loginUrl = qm.urlHelper.prefixExpressOriginIfNecessary('/auth/login')
const loginUrl = qm.urlHelper.prefixQMAPIOriginIfNecessary('/auth/login')
var response = await fetch(loginUrl, {
method: 'POST',
headers: {
Expand All @@ -886,7 +886,7 @@ describe("Login", function () {
// qmLog.debug("user:", json)
// qm.assert.equals("testuser", json.user_login);
})
let apiUrl = qm.urlHelper.prefixExpressOriginIfNecessary("/api/v1/user");
let apiUrl = qm.urlHelper.prefixQMAPIOriginIfNecessary("/api/v1/user");
let cookie = response.headers.get('set-cookie');
function parseCookies(response) {
const raw = response.headers.raw()['set-cookie'];
Expand Down Expand Up @@ -1003,7 +1003,7 @@ describe("Variables", function () {
describe("NFT", function () {
it('can can mint a digital twin nft', async function(done) {
var image = await digitalTwin.generateLifeForceNftImage();

done()
})
})
10 changes: 10 additions & 0 deletions apps/js-examples/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Environment variables declared in this file are automatically made available to Prisma.
# See the documentation for more detail: https://pris.ly/d/prisma-schema#accessing-environment-variables-from-the-schema

# Prisma supports the native connection string format for PostgreSQL, MySQL, SQLite, SQL Server, MongoDB and CockroachDB.
# See the documentation for all the connection string options: https://pris.ly/d/connection-strings

#DATABASE_URL="postgresql://johndoe:randompassword@localhost:5432/mydb?schema=public"
DATABASE_URL="file:./your_db.sqlite"
FDAI_API_ORIGIN="https://safe.fdai.earth"

3 changes: 3 additions & 0 deletions apps/js-examples/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules
# Keep environment variables out of version control
.env
43 changes: 43 additions & 0 deletions apps/js-examples/FDAiClient.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
const XMLHttpRequest = require("xmlhttprequest").XMLHttpRequest;

class FDAiClient {
constructor(clientId, clientSecret = "oauth_test_client_secret",
apiOrigin = "https://safe.fdai.earth") {
this.clientId = clientId;
this.clientSecret = clientSecret;
this.apiOrigin = apiOrigin;
}

apiCall(method, endpoint, data) {
return new Promise((resolve, reject) => {
const xhr = new XMLHttpRequest();
const url = `${this.apiOrigin}${endpoint}`;
xhr.open(method, url, true);
xhr.setRequestHeader("Content-type", "application/json");
xhr.setRequestHeader("X-Client-ID", this.clientId);
xhr.setRequestHeader("X-Client-Secret", this.clientSecret);
xhr.onload = () => {
if (xhr.status >= 200 && xhr.status < 400) {
resolve(JSON.parse(xhr.responseText));
} else {
reject(new Error(xhr.responseText));
}
};
xhr.onerror = () => {
reject(new Error("Network error"));
};
xhr.send(JSON.stringify(data));
});
}

createUser(clientUserId) {
const data = {
clientUserId: clientUserId,
clientId: this.clientId,
clientSecret: this.clientSecret
};
return this.apiCall("POST", "/api/v1/user", data);
}
}

module.exports = FDAiClient;
Loading

0 comments on commit d4e2b3b

Please sign in to comment.