From 81ccb3d4130ece8805b0f147552b5b36e0fb082a Mon Sep 17 00:00:00 2001 From: Abner Oliveira Date: Sun, 27 Sep 2015 09:35:26 -0300 Subject: [PATCH] rosie typing files --- rosie/rosie-tests.ts | 16 ++++++++++++++++ rosie/rosie.d.ts | 30 ++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 rosie/rosie-tests.ts create mode 100644 rosie/rosie.d.ts diff --git a/rosie/rosie-tests.ts b/rosie/rosie-tests.ts new file mode 100644 index 0000000000..ee6e65dc1e --- /dev/null +++ b/rosie/rosie-tests.ts @@ -0,0 +1,16 @@ +/// + +let resultObj: Object; +let resultFactory: rosie.IFactory; + +declare var Factory:rosie.IFactoryStatic; + +resultFactory = Factory.define('person').attr('name', 'John').sequence('id'); +resultObj = Factory.build('person'); + +resultFactory = Factory.define('some').sequence('id').attr('name', ['id'], (id: number) => { return 'Name ' + id.toString() }); +resultObj = Factory.build('some'); + + + +var rosieFactory = require('rosie').Factory; diff --git a/rosie/rosie.d.ts b/rosie/rosie.d.ts new file mode 100644 index 0000000000..7c20449fd0 --- /dev/null +++ b/rosie/rosie.d.ts @@ -0,0 +1,30 @@ +declare module 'rosie' { + export = rosie; +} + +declare module rosie { + interface IFactoryStatic { + + define(name: String, constructor?: Function): IFactory; + + build(name: string, attributes?: any[], options?: Object): Object; + + buildList(name: string, size: number, attributes?: any[], options?: Object): Object[]; + + attributes(attributes: Object, options?: Object): Object; + + options(options: Object): Object; + + extend(name: string): IFactory; + } + + interface IFactory { + + attr(name: string, dependenciesOrValue: any | string[], value?: any): IFactory; + + sequence(name: string, dependencies?: string[], builder?: Function) : IFactory; + + } + +} +