-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
14efffb
commit 8b6cabc
Showing
2 changed files
with
165 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,163 @@ | ||
import { ObjectId } from 'bson'; | ||
import { Fixture } from "../utils"; | ||
import { Checklist, ChecklistInsertType, ChecklistUpdateType } from "../../generated/graphql"; | ||
|
||
const checklist1 = { | ||
_id: new ObjectId("6537e59e9208f3f75b2db1f7"), | ||
owner_id: "63601cdc29e6840df23ad3e5", | ||
tags_methods: ["GMF:Known AI Technology:Language Modeling"], | ||
tags_goals: ["GMF:Known AI Goal:Chatbot"], | ||
about: "", | ||
risks: [ | ||
{ | ||
id: "09511dbb-6bd8-42de-bc7b-bbac8864455b", | ||
tags: [ | ||
"GMF:Known AI Technical Failure:Unsafe Exposure or Access" | ||
], | ||
severity: "", | ||
title: "Unsafe Exposure or Access", | ||
generated: false, | ||
risk_status: "Not Mitigated", | ||
likelihood: "", | ||
touched: false, | ||
risk_notes: "" | ||
} | ||
], | ||
tags_other: ["CSETv1:Entertainment Industry:yes"], | ||
id: "849bd303-261f-4abe-8746-77dad5841dbe", | ||
name: "Test Checklist" | ||
} | ||
|
||
const checklist2 = { | ||
_id: new ObjectId("6537e59e9208f3f75b2db1f8"), | ||
owner_id: "63601cdc29e6840df23ad3e5", | ||
tags_methods: ["GMF:Known AI Technology:Transformer"], | ||
tags_goals: ["GMF:Known AI Goal:Chatbot"], | ||
about: "", | ||
risks: [ | ||
{ | ||
id: "09511dbb-6bd8-42de-bc7b-bbac8864455b", | ||
tags: [ | ||
"GMF:Known AI Technical Failure:Unsafe Exposure or Access" | ||
], | ||
severity: "", | ||
title: "Unsafe Exposure or Access", | ||
generated: false, | ||
risk_status: "Not Mitigated", | ||
likelihood: "", | ||
touched: false, | ||
risk_notes: "" | ||
} | ||
], | ||
tags_other: ["CSETv1:Entertainment Industry:yes"], | ||
id: "849bd303-261f-4abe-8746-77dad5841dbe", | ||
name: "Test Checklist 2" | ||
} | ||
|
||
const subscriber = { | ||
_id: new ObjectId('60a7c5b7b4f5b8a6d8f9c7e6'), | ||
first_name: 'Subscriber', | ||
last_name: 'One', | ||
roles: ['subscriber'], | ||
userId: 'subscriber1', | ||
} | ||
|
||
const admin = { | ||
_id: new ObjectId('60a7c5b7b4f5b8a6d8f9c7e5'), | ||
first_name: 'Super', | ||
last_name: 'Man', | ||
roles: ['admin'], | ||
userId: 'admin', | ||
} | ||
|
||
const anonymous = { | ||
_id: new ObjectId('60a7c5b7b4f5b8a6d8f9c7e9'), | ||
first_name: 'Anon', | ||
last_name: 'Anon', | ||
roles: [], | ||
userId: 'anon', | ||
} | ||
|
||
const fixture: Fixture<Checklist, ChecklistUpdateType, ChecklistInsertType> = { | ||
name: 'checklists', | ||
query: ` | ||
_id | ||
owner_id | ||
tags_methods | ||
tags_goals | ||
about | ||
risks { | ||
id | ||
} | ||
tags_other | ||
id | ||
name | ||
`, | ||
seeds: { | ||
customData: { | ||
users: [ | ||
subscriber, | ||
admin, | ||
anonymous, | ||
], | ||
}, | ||
aiidprod: { | ||
checklists: [checklist1, checklist2] | ||
} | ||
}, | ||
testSingular: { | ||
allowed: [anonymous, subscriber, admin], | ||
denied: [], | ||
filter: { _id: { EQ: new ObjectId("6537e59e9208f3f75b2db1f7") } }, | ||
result: { | ||
id: "849bd303-261f-4abe-8746-77dad5841dbe", | ||
name: "Test Checklist", | ||
}, | ||
}, | ||
testPluralFilter: { | ||
allowed: [anonymous, subscriber, admin], | ||
denied: [], | ||
filter: { | ||
_id: { EQ: new ObjectId("6537e59e9208f3f75b2db1f7") }, | ||
}, | ||
result: [ | ||
{ | ||
id: "849bd303-261f-4abe-8746-77dad5841dbe", | ||
name: "Test Checklist", | ||
} | ||
] | ||
}, | ||
testPluralSort: { | ||
allowed: [anonymous, subscriber, admin], | ||
denied: [], | ||
sort: { name: "ASC" }, | ||
result: [ | ||
{ | ||
name: "Test Checklist", | ||
}, | ||
{ | ||
name: "Test Checklist 2", | ||
}, | ||
], | ||
}, | ||
testPluralPagination: { | ||
allowed: [subscriber], | ||
denied: [], | ||
pagination: { limit: 1, skip: 1 }, | ||
sort: { name: "ASC" }, | ||
result: [ | ||
{ | ||
name: "Test Checklist 2", | ||
}, | ||
] | ||
}, | ||
testUpdateOne: null, | ||
testUpdateMany: null, | ||
testInsertOne: null, | ||
testInsertMany: null, | ||
testDeleteOne: null, | ||
testDeleteMany: null, | ||
testUpsertOne: null, | ||
} | ||
|
||
export default fixture; |
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