| 1 |
import { Server, Model, Collection } from "miragejs"; |
| 2 |
|
| 3 |
describe("External | Shared | ORM | #none", () => { |
| 4 |
let server; |
| 5 |
|
| 6 |
beforeEach(() => { |
| 7 |
server = new Server({ |
| 8 |
environment: "test", |
| 9 |
models: { |
| 10 |
user: Model, |
| 11 |
}, |
| 12 |
}); |
| 13 |
|
| 14 |
server.db.loadData({ |
| 15 |
user: [ |
| 16 |
{ id: 1, name: "Link", good: true }, |
| 17 |
{ id: 2, name: "Zelda", good: true }, |
| 18 |
{ id: 3, name: "Ganon", good: false }, |
| 19 |
], |
| 20 |
}); |
| 21 |
}); |
| 22 |
|
| 23 |
afterEach(() => { |
| 24 |
server.shutdown(); |
| 25 |
}); |
| 26 |
|
| 27 |
test("it returns an empty collection", () => { |
| 28 |
let users = server.schema.users.none(); |
| 29 |
|
| 30 |
expect(users instanceof Collection).toBeTruthy(); |
| 31 |
expect(users.models).toHaveLength(0); |
| 32 |
}); |
| 33 |
}); |