import {Collection, Model, Types} from "../../../lib/index"; import assert from "assert"; class Product extends Model { structure() { return { name: Types.String, price: Types.Number }; } } describe("Collection.first", () => { it("first()", () => { class Products extends Collection { Model() { return Product; } } const products = new Products([ {name: "Eggs", price: 1.8}, {name: "Pie", price: 10} ]); const model = products.first(); assert.strictEqual( products.at(0), model ); }); });