Last active
September 28, 2023 21:31
-
-
Save jgaehring/8fa99079e7597fffef88af41c9ebe01e to your computer and use it in GitHub Desktop.
Testing the `limit` option in farmOS.js
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
node_modules/** | |
dist/** | |
report.json | |
errors.json | |
.env |
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
const farmOS = require('farmos').default; | |
const parseFilter = require('farmos').parseFilter; | |
const { username, password, remote } = require('./local-server-config.js'); | |
const parsed = parseFilter({ | |
land_type: ["field", "bed"], | |
}); | |
console.log(parsed); | |
const farm = farmOS({ remote }); | |
farm.remote.authorize(username, password) | |
.then(() => farm.schema.fetch()) | |
.then(() => { | |
const filter = { type: 'asset--plant' }; | |
return farm.asset.fetch({ filter }); | |
}) | |
.then((response) => { | |
console.log('PLANTS:\n', response.data.length); | |
}); | |
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
require('dotenv').config(); | |
// These are the parameters required to connect to the local server used by | |
// tests and scripts in both the development and CI environments. | |
module.exports = { | |
remote: { | |
host: process.env.TEST_HOST, | |
clientId: process.env.TEST_CLIENT_ID, | |
}, | |
username: process.env.TEST_USERNAME, | |
password: process.env.TEST_PASSWORD, | |
}; |
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
{ | |
"name": "limit-test", | |
"version": "1.0.0", | |
"lockfileVersion": 3, | |
"requires": true, | |
"packages": { | |
"": { | |
"name": "limit-test", | |
"version": "1.0.0", | |
"license": "ISC", | |
"dependencies": { | |
"dotenv": "^16.0.3", | |
"farmos": "2.0.0-beta.16" | |
} | |
}, | |
"../../farmOS.js": { | |
"name": "farmos", | |
"version": "2.0.0-beta.16", | |
"license": "MIT", | |
"dependencies": { | |
"axios": "^0.25.0", | |
"ramda": "^0.27.1", | |
"uuid": "^8.3.2" | |
}, | |
"devDependencies": { | |
"@rollup/plugin-commonjs": "^21.0.1", | |
"@rollup/plugin-json": "^4.1.0", | |
"@rollup/plugin-node-resolve": "^13.1.1", | |
"chai": "^4.2.0", | |
"chai-as-promised": "^7.1.1", | |
"chai-string": "^1.5.0", | |
"dotenv": "^16.0.3", | |
"eslint": "^8.7.0", | |
"eslint-config-airbnb-base": "^15.0.0", | |
"eslint-plugin-import": "^2.25.4", | |
"jsdoc-to-markdown": "^7.1.0", | |
"jsdoc-tsimport-plugin": "^1.0.5", | |
"mocha": "^9.1.3", | |
"rollup": "^2.61.1", | |
"typescript": "^4.4.3" | |
} | |
}, | |
"node_modules/dotenv": { | |
"version": "16.3.1", | |
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.3.1.tgz", | |
"integrity": "sha512-IPzF4w4/Rd94bA9imS68tZBaYyBWSCE47V1RGuMrB94iyTOIEwRmVL2x/4An+6mETpLrKJ5hQkB8W4kFAadeIQ==", | |
"engines": { | |
"node": ">=12" | |
}, | |
"funding": { | |
"url": "https://github.com/motdotla/dotenv?sponsor=1" | |
} | |
}, | |
"node_modules/farmos": { | |
"resolved": "../../farmOS.js", | |
"link": true | |
} | |
} | |
} |
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
{ | |
"name": "limit-test", | |
"version": "1.0.0", | |
"description": "", | |
"main": "index.js", | |
"scripts": { | |
"test": "node index.js" | |
}, | |
"keywords": [], | |
"author": "", | |
"license": "ISC", | |
"dependencies": { | |
"dotenv": "^16.0.3", | |
"farmos": "2.0.0-beta.16" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment