@rbxts/fitumi
TypeScript icon, indicating that this package has built-in type declarations

1.0.11 • Public • Published

Fake It 'Till You Make It

CI status PRs Welcome License: MIT Discord server

Fake It 'Till You Make It, or fitumi, is a Lua faking library intended for helping to create comprehensive unit tests for Lua code bases. While not required, fitumi was designed with Roblox development as the primary use-case. Fitumi's design is inspired in part by FakeItEasy.

Fitumi comes paired with TypeScript annotation files for easy installation into a roblox-ts project and is published to NPM under the @rbxts/fitumi package.

Installation

roblox-ts

Simply install to your roblox-ts project as follows:

npm i @rbxts/fitumi

Wally

Wally users can install this package by adding the following line to their Wally.toml under [dependencies]:

fitumi = "bytebit/fitumi@1.0.10"

Then just run wally install.

From model file

Model files are uploaded to every release as .rbxmx files. You can download the file from the Releases page and load it into your project however you see fit.

From model asset

New versions of the asset are uploaded with every release. The asset can be added to your Roblox Inventory and then inserted into your Place via Toolbox by getting it here.

Links

Example

local fitumi = require(path.to.fitumi)
local a = fitumi.a

local fakeDependency = a.fake()
a.callTo(fakeDependency["foo"], fakeDependency, fitumi.wildcard):returns("bar")

local targetObject = TargetClass.new(fakeDependency)
targetObject:doSomething()

assert(a.callTo(fakeDependency["foo"], fakeDependency, fitumi.wildcard):didHappen(), "No call to foo happened")
assert(targetObject.fooResult == "bar", "targetObject's foo result does not match provided foo result")
assert(a.writeTo(fakeDependency, "expectedKey", "expectedValue"):didHappen(), "targetObject did not write \"expectedValue\" to \"expectedKey\"")

Readme

Keywords

none

Package Sidebar

Install

npm i @rbxts/fitumi

Weekly Downloads

5

Version

1.0.11

License

MIT

Unpacked Size

16.4 kB

Total Files

29

Last publish

Collaborators

  • noahwillcrow