Skip to content

Commit

Permalink
#706 fix search atomicdata.dev
Browse files Browse the repository at this point in the history
  • Loading branch information
joepio committed Nov 29, 2023
1 parent c2595bd commit 52a5533
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ See [STATUS.md](server/STATUS.md) to learn more about which features will remain

## UNRELEASED

- Fix locally searching for atomicdata.dev resources in external servers #706
- Use Earthly for CI: building, testing, pushing Docker images #576
- Host @tomic NPM docs [on Netlify](https://atomic-lib.netlify.app/) #707

Expand Down
13 changes: 7 additions & 6 deletions cli/tests/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
mod test {
use assert_cmd::Command;

const TEST_URL: &str =
"https://atomicdata.dev/agents/QmfpRIBn2JYEatT0MjSkMNoBJzstz19orwnT5oT2rcQ=";

#[test]
fn get_fail() {
let mut cmd = Command::cargo_bin(assert_cmd::crate_name!()).unwrap();
Expand All @@ -19,31 +22,29 @@ mod test {
#[test]
fn get_url() {
let mut cmd = Command::cargo_bin(assert_cmd::crate_name!()).unwrap();
cmd.args(["get", "https://atomicdata.dev/classes"])
.assert()
.success();
cmd.args(["get", TEST_URL]).assert().success();
}

#[test]
fn get_path() {
let mut cmd = Command::cargo_bin(assert_cmd::crate_name!()).unwrap();
cmd.args(["get", "https://atomicdata.dev/classes members"])
cmd.args(["get", &format!("{TEST_URL} name")])
.assert()
.success();
}

#[test]
fn get_path_array() {
let mut cmd = Command::cargo_bin(assert_cmd::crate_name!()).unwrap();
cmd.args(["get", "https://atomicdata.dev/classes is-a 0"])
cmd.args(["get", &format!("{TEST_URL} is-a 0")])
.assert()
.success();
}

#[test]
fn get_path_array_non_existent() {
let mut cmd = Command::cargo_bin(assert_cmd::crate_name!()).unwrap();
cmd.args(["get", "https://atomicdata.dev/classes is-a 1"])
cmd.args(["get", &format!("{TEST_URL} is-a 1")])
.assert()
.failure();
}
Expand Down
19 changes: 19 additions & 0 deletions lib/defaults/default_store.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,23 @@
[
{
"@id": "https://atomicdata.dev",
"https://atomicdata.dev/properties/read": [
"https://atomicdata.dev/agents/publicAgent"
],
"https://atomicdata.dev/properties/classtype": "https://atomicdata.dev/classes/Drive"
},
{
"@id": "https://atomicdata.dev/properties",
"https://atomicdata.dev/properties/parent": "https://atomicdata.dev"
},
{
"@id": "https://atomicdata.dev/classes",
"https://atomicdata.dev/properties/parent": "https://atomicdata.dev"
},
{
"@id": "https://atomicdata.dev/datatypes",
"https://atomicdata.dev/properties/parent": "https://atomicdata.dev"
},
{
"@id": "https://atomicdata.dev/properties/endpoint/parameters",
"https://atomicdata.dev/properties/classtype": "https://atomicdata.dev/classes/Property",
Expand Down
3 changes: 3 additions & 0 deletions server/src/appstate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ pub fn init(config: Config) -> AtomicServerResult<AppState> {
.map_err(|e| format!("Error while setting up initial invite: {}", e))?;
// This means that editing the .env does _not_ grant you the rights to edit the Drive.
tracing::info!("Setting rights to Drive {}", store.get_server_url());

tracing::info!("Adding all resources to search index");
crate::search::add_all_resources(&search_state, &store)?
}

Ok(AppState {
Expand Down

0 comments on commit 52a5533

Please sign in to comment.